Merge pull request #6707
6af25b0Add BIP65 to getblockchaininfo softforks list (Peter Todd)ba1da90Show softfork status in getblockchaininfo (Wladimir J. van der Laan)70a427bCLTV: Add more tests to improve coverage (Esteban Ordano)c5a27f4Add RPC tests for the CHECKLOCKTIMEVERIFY (BIP65) soft-fork (Peter Todd)5e82e1cAdd CHECKLOCKTIMEVERIFY (BIP65) soft-fork logic (Peter Todd)6ea5ca4Enable CHECKLOCKTIMEVERIFY as a standard script verify flag (Peter Todd)4fa7a04Replace NOP2 with CHECKLOCKTIMEVERIFY (BIP65) (Peter Todd)6ec08dbMove LOCKTIME_THRESHOLD to src/script/script.h (Peter Todd)684636bMake CScriptNum() take nMaxNumSize as an argument (Peter Todd)
This commit is contained in:
14
src/main.cpp
14
src/main.cpp
@@ -1853,11 +1853,18 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin
|
||||
|
||||
unsigned int flags = fStrictPayToScriptHash ? SCRIPT_VERIFY_P2SH : SCRIPT_VERIFY_NONE;
|
||||
|
||||
// Start enforcing the DERSIG (BIP66) rules, for block.nVersion=3 blocks, when 75% of the network has upgraded:
|
||||
// Start enforcing the DERSIG (BIP66) rules, for block.nVersion=3 blocks,
|
||||
// when 75% of the network has upgraded:
|
||||
if (block.nVersion >= 3 && IsSuperMajority(3, pindex->pprev, chainparams.GetConsensus().nMajorityEnforceBlockUpgrade, chainparams.GetConsensus())) {
|
||||
flags |= SCRIPT_VERIFY_DERSIG;
|
||||
}
|
||||
|
||||
// Start enforcing CHECKLOCKTIMEVERIFY, (BIP65) for block.nVersion=4
|
||||
// blocks, when 75% of the network has upgraded:
|
||||
if (block.nVersion >= 4 && IsSuperMajority(4, pindex->pprev, chainparams.GetConsensus().nMajorityEnforceBlockUpgrade, chainparams.GetConsensus())) {
|
||||
flags |= SCRIPT_VERIFY_CHECKLOCKTIMEVERIFY;
|
||||
}
|
||||
|
||||
CBlockUndo blockundo;
|
||||
|
||||
CCheckQueueControl<CScriptCheck> control(fScriptChecks && nScriptCheckThreads ? &scriptcheckqueue : NULL);
|
||||
@@ -2788,6 +2795,11 @@ bool ContextualCheckBlockHeader(const CBlockHeader& block, CValidationState& sta
|
||||
return state.Invalid(error("%s : rejected nVersion=2 block", __func__),
|
||||
REJECT_OBSOLETE, "bad-version");
|
||||
|
||||
// Reject block.nVersion=3 blocks when 95% (75% on testnet) of the network has upgraded:
|
||||
if (block.nVersion < 4 && IsSuperMajority(4, pindexPrev, consensusParams.nMajorityRejectBlockOutdated, consensusParams))
|
||||
return state.Invalid(error("%s : rejected nVersion=3 block", __func__),
|
||||
REJECT_OBSOLETE, "bad-version");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user