-
Notifications
You must be signed in to change notification settings - Fork 174
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ERROR: AcceptBlock: invalid proof-of-stake for block <...> and 100% CPU usage #2759
Comments
@Yamakuzure Can you grep with context or publish your full debug.log? a840be400407818a7a05e2ec2afee0f5661e0f98d6e59054edb79690507b69a7 does not seem to be in the main chain. |
Sure! I will start GridCoin and let it run for 30 minutes, to get a fresh not-too-long (the old had ~800MB) debug.log. |
Can you re-compile your node with the following patch and post a new debug.log? diff --git a/src/gridcoin/staking/kernel.cpp b/src/gridcoin/staking/kernel.cpp
index 7f1952140..158bbbd48 100644
--- a/src/gridcoin/staking/kernel.cpp
+++ b/src/gridcoin/staking/kernel.cpp
@@ -603,21 +603,21 @@ bool GRC::CheckProofOfStakeV8(
CTransaction txPrev;
if (!ReadStakedInput(txdb, prevout.hash, header, txPrev, pindexPrev))
- return tx.DoS(1, error("%s: read staked input failed", __func__));
+ return tx.DoS(10, error("%s: read staked input failed", __func__));
if (!VerifySignature(txPrev, tx, 0, 0))
return tx.DoS(100, error("%s: VerifySignature failed on coinstake %s", __func__, tx.GetHash().ToString()));
// Check times
if (tx.nTime < txPrev.nTime)
- return error("%s: nTime violation", __func__);
+ return tx.DoS(100, error("%s: nTime violation", __func__));
if (header.nTime + nStakeMinAge > tx.nTime)
- return error("%s: min age violation", __func__);
+ return tx.DoS(100, error("%s: min age violation", __func__));
if (Block.nVersion >= 12) {
if (tx.nTime != MaskStakeTime(tx.nTime)) {
- return error("%s: mask violation", __func__);
+ return tx.DoS(100, error("%s: mask violation", __func__));
}
}
@@ -649,5 +649,9 @@ bool GRC::CheckProofOfStakeV8(
);
// Now check if proof-of-stake hash meets target protocol
- return bnHashProof <= bnTarget;
+ if (bnHashProof <= bnTarget) {
+ return true;
+ }
+
+ return tx.DoS(100, error("%s: invalid proof (proof: %s, target: %s)", __func__, bnHashProof.GetHex(), bnTarget.GetHex()));
} |
Also please make sure |
The patched version was compiled successfully and is now installed. I'll let it run for 30 minutes and will post another debug.log. @div72 : The log is too big for pastebin, so I attach it here. |
This patch was added to #2758. |
Bug Report
Current behavior
After some minutes the CPU usage of
gridcoinresearch
starts rising, until it reaches constant ~100% on one VCPU.Meanwhile the
debug.log
starts filling with the same line over and over again:(line breaks by me for readability)
Expected behavior
If AcceptBlock failed, and the chain is valid nevertheless, I would expect the failed block to be discarded.
Steps to reproduce:
When this first happened I deleted
accrual
,blk*.dat
andtxleveldb
so the program had to re-sync from scratch, but the above problem reappeared after a few hour.The interesting part is, that it is always the same block after the same prev. So this seems to be a real broken block in the global chain and not some sync error on my machine.
Gridcoin version
5.4.7.0-leisure
Machine specs
Extra information
The text was updated successfully, but these errors were encountered: