Skip to content

Commit 3b2bcd8

Browse files
committed
Add missing block nVersion check for v12 blocks in AcceptBlock
1 parent ca55309 commit 3b2bcd8

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

src/main.cpp

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2667,20 +2667,23 @@ bool CBlock::AcceptBlock(bool generated_by_me) EXCLUSIVE_LOCKS_REQUIRED(cs_main)
26672667

26682668
// The block height at which point we start rejecting v7 blocks and
26692669
// start accepting v8 blocks.
2670-
if( (IsProtocolV2(nHeight) && nVersion < 7)
2671-
|| (IsV8Enabled(nHeight) && nVersion < 8)
2672-
|| (IsV9Enabled(nHeight) && nVersion < 9)
2673-
|| (IsV10Enabled(nHeight) && nVersion < 10)
2674-
|| (IsV11Enabled(nHeight) && nVersion < 11)
2675-
)
2670+
if ((IsProtocolV2(nHeight) && nVersion < 7)
2671+
|| (IsV8Enabled(nHeight) && nVersion < 8)
2672+
|| (IsV9Enabled(nHeight) && nVersion < 9)
2673+
|| (IsV10Enabled(nHeight) && nVersion < 10)
2674+
|| (IsV11Enabled(nHeight) && nVersion < 11)
2675+
|| (IsV12Enabled(nHeight) && nVersion < 12)
2676+
) {
26762677
return DoS(20, error("AcceptBlock() : reject too old nVersion = %d", nVersion));
2677-
else if( (!IsProtocolV2(nHeight) && nVersion >= 7)
2678-
||(!IsV8Enabled(nHeight) && nVersion >= 8)
2679-
||(!IsV9Enabled(nHeight) && nVersion >= 9)
2680-
||(!IsV10Enabled(nHeight) && nVersion >= 10)
2681-
||(!IsV11Enabled(nHeight) && nVersion >= 11)
2682-
)
2678+
} else if ((!IsProtocolV2(nHeight) && nVersion >= 7)
2679+
|| (!IsV8Enabled(nHeight) && nVersion >= 8)
2680+
|| (!IsV9Enabled(nHeight) && nVersion >= 9)
2681+
|| (!IsV10Enabled(nHeight) && nVersion >= 10)
2682+
|| (!IsV11Enabled(nHeight) && nVersion >= 11)
2683+
|| (!IsV12Enabled(nHeight) && nVersion >= 12)
2684+
) {
26832685
return DoS(100, error("AcceptBlock() : reject too new nVersion = %d", nVersion));
2686+
}
26842687

26852688
if (IsProofOfWork() && nHeight > LAST_POW_BLOCK)
26862689
return DoS(100, error("AcceptBlock() : reject proof-of-work at height %d", nHeight));

0 commit comments

Comments
 (0)