diff options
Diffstat (limited to 'src/main.cpp')
-rw-r--r-- | src/main.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/main.cpp b/src/main.cpp index e7a7140a91..b4f69f8c96 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1645,6 +1645,12 @@ bool CBlock::ConnectBlock(CValidationState &state, CBlockIndex* pindex, CCoinsVi unsigned int flags = SCRIPT_VERIFY_NOCACHE | (fStrictPayToScriptHash ? SCRIPT_VERIFY_P2SH : SCRIPT_VERIFY_NONE); + if (nVersion >= 3 && + ((!fTestNet && CBlockIndex::IsSuperMajority(3, pindex->pprev, 750, 1000)) || + (fTestNet && CBlockIndex::IsSuperMajority(3, pindex->pprev, 51, 100)))) { + flags |= SCRIPT_VERIFY_DERSIG; + } + CBlockUndo blockundo; CCheckQueueControl<CScriptCheck> control(fScriptChecks && nScriptCheckThreads ? &scriptcheckqueue : NULL); @@ -2193,6 +2199,15 @@ bool CBlock::AcceptBlock(CValidationState &state, CDiskBlockPos *dbp) return state.Invalid(error("AcceptBlock() : rejected nVersion=1 block")); } } + // Reject block.nVersion=2 blocks when 95% (75% on testnet) of the network has upgraded: + if (nVersion < 3) + { + if ((!fTestNet && CBlockIndex::IsSuperMajority(3, pindexPrev, 950, 1000)) || + (fTestNet && CBlockIndex::IsSuperMajority(3, pindexPrev, 75, 100))) + { + return state.Invalid(error("AcceptBlock() : rejected nVersion=2 block")); + } + } // Enforce block.nVersion=2 rule that the coinbase starts with serialized block height if (nVersion >= 2) { |