@@ -1771,9 +1771,7 @@ bool CChainState::ConnectBlock(const CBlock& block, CValidationState& state, CBl
1771
1771
{
1772
1772
AssertLockHeld (cs_main);
1773
1773
assert (pindex);
1774
- // pindex->phashBlock can be null if called by CreateNewBlock/TestBlockValidity
1775
- assert ((pindex->phashBlock == nullptr ) ||
1776
- (*pindex->phashBlock == block.GetHash ()));
1774
+ assert (*pindex->phashBlock == block.GetHash ());
1777
1775
int64_t nTimeStart = GetTimeMicros ();
1778
1776
1779
1777
// Check it again in case a previous version let a bad block in
@@ -1847,8 +1845,7 @@ bool CChainState::ConnectBlock(const CBlock& block, CValidationState& state, CBl
1847
1845
// Now that the whole chain is irreversibly beyond that time it is applied to all blocks except the
1848
1846
// two in the chain that violate it. This prevents exploiting the issue against nodes during their
1849
1847
// initial block download.
1850
- bool fEnforceBIP30 = (!pindex->phashBlock ) || // Enforce on CreateNewBlock invocations which don't have a hash.
1851
- !((pindex->nHeight ==91842 && pindex->GetBlockHash () == uint256S (" 0x00000000000a4d0a398161ffc163c503763b1f4360639393e0e4c8e300e0caec" )) ||
1848
+ bool fEnforceBIP30 = !((pindex->nHeight ==91842 && pindex->GetBlockHash () == uint256S (" 0x00000000000a4d0a398161ffc163c503763b1f4360639393e0e4c8e300e0caec" )) ||
1852
1849
(pindex->nHeight ==91880 && pindex->GetBlockHash () == uint256S (" 0x00000000000743f190a18c5577a3c2d2a1f610ae9601ac046a38084ccb7cd721" )));
1853
1850
1854
1851
// Once BIP34 activated it was not possible to create new duplicate coinbases and thus other than starting
@@ -3417,9 +3414,11 @@ bool TestBlockValidity(CValidationState& state, const CChainParams& chainparams,
3417
3414
AssertLockHeld (cs_main);
3418
3415
assert (pindexPrev && pindexPrev == chainActive.Tip ());
3419
3416
CCoinsViewCache viewNew (pcoinsTip.get ());
3417
+ uint256 block_hash (block.GetHash ());
3420
3418
CBlockIndex indexDummy (block);
3421
3419
indexDummy.pprev = pindexPrev;
3422
3420
indexDummy.nHeight = pindexPrev->nHeight + 1 ;
3421
+ indexDummy.phashBlock = &block_hash;
3423
3422
3424
3423
// NOTE: CheckBlockHeader is called by CheckBlock
3425
3424
if (!ContextualCheckBlockHeader (block, state, chainparams, pindexPrev, GetAdjustedTime ()))
0 commit comments