mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-03-06 14:19:59 -05:00
Merge bitcoin/bitcoin#28791: snapshots: don't core dump when running -checkblockindex after loadtxoutset
cdc6ac4126
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: utACKcdc6ac4126
achow101: ACKcdc6ac4126
pablomartin4btc: tACKcdc6ac4126
Tree-SHA512: f7488a85cc29056e2ac443ce8f34aea4dfde6ba246efce82235d6a4dca2dca4344f07b93c93424b4addcb83e4cb2ae49a3ebb37d89840d42d2aeea35904cab04
This commit is contained in:
commit
a3fb1f80ac
1 changed files with 3 additions and 1 deletions
|
@ -4868,7 +4868,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;
|
||||
|
|
Loading…
Add table
Reference in a new issue