Skip to content

Commit d59b8d6

Browse files
committed
Merge #11880: Stop special-casing phashBlock handling in validation for TBV
9c5a4a6 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 bitcoin/bitcoin#11739 (comment) Tree-SHA512: 37cb1ae5b11c9e8ed7a679bb07ad3b119a2a014744b26d197d67ba21beb19fe6815271df935e40f7c7bd5f2e4d7ae4dad7bd4d00fa230a8d789f37e9de31a769
2 parents c8ea91a + 9c5a4a6 commit d59b8d6

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/validation.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1773,9 +1773,7 @@ bool CChainState::ConnectBlock(const CBlock& block, CValidationState& state, CBl
17731773
{
17741774
AssertLockHeld(cs_main);
17751775
assert(pindex);
1776-
// pindex->phashBlock can be null if called by CreateNewBlock/TestBlockValidity
1777-
assert((pindex->phashBlock == nullptr) ||
1778-
(*pindex->phashBlock == block.GetHash()));
1776+
assert(*pindex->phashBlock == block.GetHash());
17791777
int64_t nTimeStart = GetTimeMicros();
17801778

17811779
// Check it again in case a previous version let a bad block in
@@ -1849,8 +1847,7 @@ bool CChainState::ConnectBlock(const CBlock& block, CValidationState& state, CBl
18491847
// Now that the whole chain is irreversibly beyond that time it is applied to all blocks except the
18501848
// two in the chain that violate it. This prevents exploiting the issue against nodes during their
18511849
// initial block download.
1852-
bool fEnforceBIP30 = (!pindex->phashBlock) || // Enforce on CreateNewBlock invocations which don't have a hash.
1853-
!((pindex->nHeight==91842 && pindex->GetBlockHash() == uint256S("0x00000000000a4d0a398161ffc163c503763b1f4360639393e0e4c8e300e0caec")) ||
1850+
bool fEnforceBIP30 = !((pindex->nHeight==91842 && pindex->GetBlockHash() == uint256S("0x00000000000a4d0a398161ffc163c503763b1f4360639393e0e4c8e300e0caec")) ||
18541851
(pindex->nHeight==91880 && pindex->GetBlockHash() == uint256S("0x00000000000743f190a18c5577a3c2d2a1f610ae9601ac046a38084ccb7cd721")));
18551852

18561853
// Once BIP34 activated it was not possible to create new duplicate coinbases and thus other than starting
@@ -3434,9 +3431,11 @@ bool TestBlockValidity(CValidationState& state, const CChainParams& chainparams,
34343431
AssertLockHeld(cs_main);
34353432
assert(pindexPrev && pindexPrev == chainActive.Tip());
34363433
CCoinsViewCache viewNew(pcoinsTip.get());
3434+
uint256 block_hash(block.GetHash());
34373435
CBlockIndex indexDummy(block);
34383436
indexDummy.pprev = pindexPrev;
34393437
indexDummy.nHeight = pindexPrev->nHeight + 1;
3438+
indexDummy.phashBlock = &block_hash;
34403439

34413440
// NOTE: CheckBlockHeader is called by CheckBlock
34423441
if (!ContextualCheckBlockHeader(block, state, chainparams, pindexPrev, GetAdjustedTime()))

0 commit comments

Comments
 (0)