snapshots: don't core dump when running -checkblockindex after loadtxoutset

Github-Pull: #28791
Rebased-From: cdc6ac4126
This commit is contained in:
Mark Friedenbach 2023-11-04 12:32:17 -07:00 committed by glozow
parent 7ec34554af
commit 438ac2947d
No known key found for this signature in database
GPG key ID: BA03F4DBE0C63FB4

View file

@ -4850,7 +4850,9 @@ void ChainstateManager::CheckBlockIndex()
// For testing, allow transaction counts to be completely unset.
|| (pindex->nChainTx == 0 && pindex->nTx == 0)
// For testing, allow this nChainTx to be unset if previous is also unset.
|| (pindex->nChainTx == 0 && prev_chain_tx == 0 && pindex->pprev));
|| (pindex->nChainTx == 0 && prev_chain_tx == 0 && pindex->pprev)
// Transaction counts prior to snapshot are unknown.
|| pindex->IsAssumedValid());
if (pindexFirstAssumeValid == nullptr && pindex->nStatus & BLOCK_ASSUMED_VALID) pindexFirstAssumeValid = pindex;
if (pindexFirstInvalid == nullptr && pindex->nStatus & BLOCK_FAILED_VALID) pindexFirstInvalid = pindex;