Skip to content

Commit

Permalink
Consensus: reject blocks with outdated version (<8) after v5 enforcement
Browse files Browse the repository at this point in the history
  • Loading branch information
random-zebra committed Dec 17, 2020
1 parent a6ea4e1 commit a2e446f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/validation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2953,11 +2953,12 @@ bool ContextualCheckBlockHeader(const CBlockHeader& block, CValidationState& sta
return state.DoS(0, error("%s : forked chain older than last checkpoint (height %d)", __func__, nHeight));

// Reject outdated version blocks
if((block.nVersion < 3 && nHeight >= 1) ||
if ((block.nVersion < 3 && nHeight >= 1) ||
(block.nVersion < 4 && consensus.NetworkUpgradeActive(nHeight, Consensus::UPGRADE_ZC)) ||
(block.nVersion < 5 && consensus.NetworkUpgradeActive(nHeight, Consensus::UPGRADE_BIP65)) ||
(block.nVersion < 6 && consensus.NetworkUpgradeActive(nHeight, Consensus::UPGRADE_V3_4)) ||
(block.nVersion < 7 && consensus.NetworkUpgradeActive(nHeight, Consensus::UPGRADE_V4_0)))
(block.nVersion < 7 && consensus.NetworkUpgradeActive(nHeight, Consensus::UPGRADE_V4_0)) ||
(block.nVersion < 8 && consensus.NetworkUpgradeActive(nHeight, Consensus::UPGRADE_V5_0)))
{
std::string stringErr = strprintf("rejected block version %d at height %d", block.nVersion, nHeight);
return state.Invalid(false, REJECT_OBSOLETE, "bad-version", stringErr);
Expand Down

0 comments on commit a2e446f

Please sign in to comment.