Move block height check from ContextualCheckBlock() to ConnectBlock()
This commit is contained in:
@@ -2413,6 +2413,11 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin
|
||||
return true;
|
||||
}
|
||||
|
||||
// Reject proof-of-work after nLastPOWBlock
|
||||
if (block.IsProofOfWork() && pindex->nHeight > chainparams.GetConsensus().nLastPOWBlock)
|
||||
return state.DoS(100, error("%s: reject proof-of-work at height %d", __func__, pindex->nHeight),
|
||||
REJECT_INVALID, "bad-pow-height");
|
||||
|
||||
// Check difficulty
|
||||
if (block.nBits != GetNextTargetRequired(pindex->pprev, &block, block.IsProofOfStake(), chainparams.GetConsensus()))
|
||||
return state.DoS(100, error("%s: incorrect difficulty", __func__),
|
||||
@@ -3714,9 +3719,6 @@ bool ContextualCheckBlock(const CBlock& block, CValidationState& state, CBlockIn
|
||||
const int nHeight = pindexPrev == NULL ? 0 : pindexPrev->nHeight + 1;
|
||||
const Consensus::Params& consensusParams = Params().GetConsensus();
|
||||
|
||||
if (block.IsProofOfWork() && nHeight > consensusParams.nLastPOWBlock)
|
||||
return state.DoS(100, error("%s : reject proof-of-work at height %d", __func__, nHeight), REJECT_INVALID, "bad-pow-height");
|
||||
|
||||
// Start enforcing BIP113 (Median Time Past) using versionbits logic.
|
||||
int nLockTimeFlags = 0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user