diff options
author | Pieter Wuille <pieter.wuille@gmail.com> | 2015-01-19 18:37:21 -0500 |
---|---|---|
committer | Pieter Wuille <pieter.wuille@gmail.com> | 2015-02-01 17:51:24 -0400 |
commit | 5a47811da5158df763aa2fca09ce646ee0c51e7b (patch) | |
tree | b94bdd9ae683fa5e449e37ab78b7419b8d9f409b /src/main.cpp | |
parent | 092e9fe5fb61ff7ce38dc2820938106fc0f0081d (diff) |
BIP66 changeover logic
Diffstat (limited to 'src/main.cpp')
-rw-r--r-- | src/main.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/main.cpp b/src/main.cpp index 7cc69c318b..f20575eaf2 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1764,6 +1764,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 && IsSuperMajority(3, pindex->pprev, Params().EnforceBlockUpgradeMajority())) { + flags |= SCRIPT_VERIFY_DERSIG; + } + CBlockUndo blockundo; CCheckQueueControl<CScriptCheck> control(fScriptChecks && nScriptCheckThreads ? &scriptcheckqueue : NULL); @@ -2601,6 +2606,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 && IsSuperMajority(3, pindexPrev, Params().RejectBlockOutdatedMajority())) + { + return state.Invalid(error("%s : rejected nVersion=2 block", __func__), + REJECT_OBSOLETE, "bad-version"); + } + return true; } |