Skip to content

Commit 4d51e9b

Browse files
committed
Assert ConnectBlock block and pIndex are the same block
1 parent 972714c commit 4d51e9b

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/validation.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1739,7 +1739,10 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin
17391739
CCoinsViewCache& view, const CChainParams& chainparams, bool fJustCheck)
17401740
{
17411741
AssertLockHeld(cs_main);
1742-
1742+
assert(pindex);
1743+
// pindex->phashBlock can be null if called by CreateNewBlock/TestBlockValidity
1744+
assert((pindex->phashBlock == NULL) ||
1745+
(*pindex->phashBlock == block.GetHash()));
17431746
int64_t nTimeStart = GetTimeMicros();
17441747

17451748
// Check it again in case a previous version let a bad block in

0 commit comments

Comments
 (0)