aboutsummaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authorPieter Wuille <pieter.wuille@gmail.com>2015-11-12 14:31:35 +0100
committerPieter Wuille <pieter.wuille@gmail.com>2015-11-12 14:37:10 +0100
commit54e8bfec8387ee154f8b15b41ae0b29bc2cd9bbc (patch)
treeb61a5b9472c87b2f0baf30d046c63d171f66776f /src/main.cpp
parent5fcc14ee0562faff2ace17082f664e60c375b334 (diff)
parent33c90cf197223fb95f858db80d090d570d70498a (diff)
Merge pull request #6931
33c90cf Make skipping BIP30 check chain agnostic (Alex Morcos) 06d81ad Skip BIP30 check after BIP34 activation (Alex Morcos)
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/main.cpp b/src/main.cpp
index f1a4527540..6e5a81f306 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -1769,6 +1769,17 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin
bool fEnforceBIP30 = (!pindex->phashBlock) || // Enforce on CreateNewBlock invocations which don't have a hash.
!((pindex->nHeight==91842 && pindex->GetBlockHash() == uint256S("0x00000000000a4d0a398161ffc163c503763b1f4360639393e0e4c8e300e0caec")) ||
(pindex->nHeight==91880 && pindex->GetBlockHash() == uint256S("0x00000000000743f190a18c5577a3c2d2a1f610ae9601ac046a38084ccb7cd721")));
+
+ // Once BIP34 activated it was not possible to create new duplicate coinbases and thus other than starting
+ // with the 2 existing duplicate coinbase pairs, not possible to create overwriting txs. But by the
+ // time BIP34 activated, in each of the existing pairs the duplicate coinbase had overwritten the first
+ // before the first had been spent. Since those coinbases are sufficiently buried its no longer possible to create further
+ // duplicate transactions descending from the known pairs either.
+ // If we're on the known chain at height greater than where BIP34 activated, we can save the db accesses needed for the BIP30 check.
+ CBlockIndex *pindexBIP34height = pindex->pprev->GetAncestor(chainparams.GetConsensus().BIP34Height);
+ //Only continue to enforce if we're below BIP34 activation height or the block hash at that height doesn't correspond.
+ fEnforceBIP30 = fEnforceBIP30 && (!pindexBIP34height || !(pindexBIP34height->GetBlockHash() == chainparams.GetConsensus().BIP34Hash));
+
if (fEnforceBIP30) {
BOOST_FOREACH(const CTransaction& tx, block.vtx) {
const CCoins* coins = view.AccessCoins(tx.GetHash());