diff --git a/src/main.cpp b/src/main.cpp index d37596fed..bbb3be712 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -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;