mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-02-09 08:43:04 +01:00
Merge pull request #5714
3916a81Increase coverage of DERSIG edge cases (Pieter Wuille)6da2028Add RPC test for DERSIG BIP switchover logic (Pieter Wuille)773c30dBIP66 changeover logic (Pieter Wuille)18695f0Example unit tests from BIP66 (Pieter Wuille)abfbeafChange IsDERSignature to BIP66 implementation (Pieter Wuille)
This commit is contained in:
12
src/main.cpp
12
src/main.cpp
@@ -1685,6 +1685,11 @@ 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:
|
||||
if (block.nVersion >= 3 && CBlockIndex::IsSuperMajority(3, pindex->pprev, Params().EnforceBlockUpgradeMajority())) {
|
||||
flags |= SCRIPT_VERIFY_DERSIG;
|
||||
}
|
||||
|
||||
CBlockUndo blockundo;
|
||||
|
||||
CCheckQueueControl<CScriptCheck> control(fScriptChecks && nScriptCheckThreads ? &scriptcheckqueue : NULL);
|
||||
@@ -2524,6 +2529,13 @@ bool ContextualCheckBlockHeader(const CBlockHeader& block, CValidationState& sta
|
||||
REJECT_OBSOLETE, "bad-version");
|
||||
}
|
||||
|
||||
// Reject block.nVersion=2 blocks when 95% (75% on testnet) of the network has upgraded:
|
||||
if (block.nVersion < 3 && CBlockIndex::IsSuperMajority(3, pindexPrev, Params().RejectBlockOutdatedMajority()))
|
||||
{
|
||||
return state.Invalid(error("%s : rejected nVersion=2 block", __func__),
|
||||
REJECT_OBSOLETE, "bad-version");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user