Merge #11880: Stop special-casing phashBlock handling in validation for TBV

9c5a4a6ed Stop special-casing phashBlock handling in validation for TBV (Matt Corallo)

Pull request description:

  There is no reason to do this, really, we already have "ignore PoW" flags. Motivated by https://github.com/bitcoin/bitcoin/pull/11739#discussion_r155841721

Tree-SHA512: 37cb1ae5b11c9e8ed7a679bb07ad3b119a2a014744b26d197d67ba21beb19fe6815271df935e40f7c7bd5f2e4d7ae4dad7bd4d00fa230a8d789f37e9de31a769
This commit is contained in:
Wladimir J. van der Laan 2018-03-05 20:08:08 +01:00 committed by Pasta
parent 9dd01a17a3
commit 4e26e4e72c
No known key found for this signature in database
GPG Key ID: 52527BEDABE87984

View File

@ -1943,9 +1943,7 @@ bool CChainState::ConnectBlock(const CBlock& block, CValidationState& state, CBl
{ {
AssertLockHeld(cs_main); AssertLockHeld(cs_main);
assert(pindex); assert(pindex);
// pindex->phashBlock can be null if called by CreateNewBlock/TestBlockValidity assert(*pindex->phashBlock == block.GetHash());
assert((pindex->phashBlock == nullptr) ||
(*pindex->phashBlock == block.GetHash()));
int64_t nTimeStart = GetTimeMicros(); int64_t nTimeStart = GetTimeMicros();
// Check it again in case a previous version let a bad block in // Check it again in case a previous version let a bad block in
@ -2033,8 +2031,7 @@ bool CChainState::ConnectBlock(const CBlock& block, CValidationState& state, CBl
// Now that the whole chain is irreversibly beyond that time it is applied to all blocks except the // Now that the whole chain is irreversibly beyond that time it is applied to all blocks except the
// two in the chain that violate it. This prevents exploiting the issue against nodes during their // two in the chain that violate it. This prevents exploiting the issue against nodes during their
// initial block download. // initial block download.
bool fEnforceBIP30 = (!pindex->phashBlock) || // Enforce on CreateNewBlock invocations which don't have a hash. bool fEnforceBIP30 = !((pindex->nHeight==91842 && pindex->GetBlockHash() == uint256S("0x00000000000a4d0a398161ffc163c503763b1f4360639393e0e4c8e300e0caec")) ||
!((pindex->nHeight==91842 && pindex->GetBlockHash() == uint256S("0x00000000000a4d0a398161ffc163c503763b1f4360639393e0e4c8e300e0caec")) ||
(pindex->nHeight==91880 && pindex->GetBlockHash() == uint256S("0x00000000000743f190a18c5577a3c2d2a1f610ae9601ac046a38084ccb7cd721"))); (pindex->nHeight==91880 && pindex->GetBlockHash() == uint256S("0x00000000000743f190a18c5577a3c2d2a1f610ae9601ac046a38084ccb7cd721")));
// Once BIP34 activated it was not possible to create new duplicate coinbases and thus other than starting // Once BIP34 activated it was not possible to create new duplicate coinbases and thus other than starting
@ -3803,9 +3800,11 @@ bool TestBlockValidity(CValidationState& state, const CChainParams& chainparams,
} }
CCoinsViewCache viewNew(pcoinsTip.get()); CCoinsViewCache viewNew(pcoinsTip.get());
uint256 block_hash(block.GetHash());
CBlockIndex indexDummy(block); CBlockIndex indexDummy(block);
indexDummy.pprev = pindexPrev; indexDummy.pprev = pindexPrev;
indexDummy.nHeight = pindexPrev->nHeight + 1; indexDummy.nHeight = pindexPrev->nHeight + 1;
indexDummy.phashBlock = &block_hash;
// begin tx and let it rollback // begin tx and let it rollback
auto dbTx = evoDb->BeginTransaction(); auto dbTx = evoDb->BeginTransaction();