@@ -1740,11 +1740,18 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin
1740
1740
1741
1741
unsigned int flags = fStrictPayToScriptHash ? SCRIPT_VERIFY_P2SH : SCRIPT_VERIFY_NONE;
1742
1742
1743
- // Start enforcing the DERSIG (BIP66) rules, for block.nVersion=3 blocks, when 75% of the network has upgraded:
1743
+ // Start enforcing the DERSIG (BIP66) rules, for block.nVersion=3 blocks,
1744
+ // when 75% of the network has upgraded:
1744
1745
if (block.nVersion >= 3 && IsSuperMajority (3 , pindex->pprev , chainparams.GetConsensus ().nMajorityEnforceBlockUpgrade , chainparams.GetConsensus ())) {
1745
1746
flags |= SCRIPT_VERIFY_DERSIG;
1746
1747
}
1747
1748
1749
+ // Start enforcing CHECKLOCKTIMEVERIFY, (BIP65) for block.nVersion=4
1750
+ // blocks, when 75% of the network has upgraded:
1751
+ if (block.nVersion >= 4 && IsSuperMajority (4 , pindex->pprev , chainparams.GetConsensus ().nMajorityEnforceBlockUpgrade , chainparams.GetConsensus ())) {
1752
+ flags |= SCRIPT_VERIFY_CHECKLOCKTIMEVERIFY;
1753
+ }
1754
+
1748
1755
CBlockUndo blockundo;
1749
1756
1750
1757
CCheckQueueControl<CScriptCheck> control (fScriptChecks && nScriptCheckThreads ? &scriptcheckqueue : NULL );
@@ -2684,6 +2691,11 @@ bool ContextualCheckBlockHeader(const CBlockHeader& block, CValidationState& sta
2684
2691
return state.Invalid (error (" %s : rejected nVersion=2 block" , __func__),
2685
2692
REJECT_OBSOLETE, " bad-version" );
2686
2693
2694
+ // Reject block.nVersion=3 blocks when 95% (75% on testnet) of the network has upgraded:
2695
+ if (block.nVersion < 4 && IsSuperMajority (4 , pindexPrev, consensusParams.nMajorityRejectBlockOutdated , consensusParams))
2696
+ return state.Invalid (error (" %s : rejected nVersion=3 block" , __func__),
2697
+ REJECT_OBSOLETE, " bad-version" );
2698
+
2687
2699
return true ;
2688
2700
}
2689
2701
0 commit comments