Skip to content

Commit a3fb1f8

Browse files
committed
Merge bitcoin/bitcoin#28791: snapshots: don't core dump when running -checkblockindex after loadtxoutset
cdc6ac4 snapshots: don't core dump when running -checkblockindex after `loadtxoutset` (Mark Friedenbach) Pull request description: Transaction counts aren't known for block history loaded from a snapshot. If you start with `-checkblockindex` after loading a snapshot, the bitcoin daemon will core dump. The test suite does not check for this because all the snapshots have no non-coinbase transactions (all blocks prior to the snapshot are assumed to have `nTx = 1`). Recommend for backport to 26.x ACKs for top commit: fjahr: utACK cdc6ac4 achow101: ACK cdc6ac4 pablomartin4btc: tACK cdc6ac4 Tree-SHA512: f7488a85cc29056e2ac443ce8f34aea4dfde6ba246efce82235d6a4dca2dca4344f07b93c93424b4addcb83e4cb2ae49a3ebb37d89840d42d2aeea35904cab04
2 parents 5711da6 + cdc6ac4 commit a3fb1f8

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/validation.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4868,7 +4868,9 @@ void ChainstateManager::CheckBlockIndex()
48684868
// For testing, allow transaction counts to be completely unset.
48694869
|| (pindex->nChainTx == 0 && pindex->nTx == 0)
48704870
// For testing, allow this nChainTx to be unset if previous is also unset.
4871-
|| (pindex->nChainTx == 0 && prev_chain_tx == 0 && pindex->pprev));
4871+
|| (pindex->nChainTx == 0 && prev_chain_tx == 0 && pindex->pprev)
4872+
// Transaction counts prior to snapshot are unknown.
4873+
|| pindex->IsAssumedValid());
48724874

48734875
if (pindexFirstAssumeValid == nullptr && pindex->nStatus & BLOCK_ASSUMED_VALID) pindexFirstAssumeValid = pindex;
48744876
if (pindexFirstInvalid == nullptr && pindex->nStatus & BLOCK_FAILED_VALID) pindexFirstInvalid = pindex;

0 commit comments

Comments
 (0)