aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Friedenbach <mark@friedenbach.org>2023-11-04 12:32:17 -0700
committerglozow <gloriajzhao@gmail.com>2024-01-19 16:13:05 +0000
commit438ac2947dd76f9abd11d73b442656d5c77754cf (patch)
tree7149468687d670450312c1b9bc88c37aa08a101e
parent7ec34554afca9159096720de36f44707a4c628ce (diff)
snapshots: don't core dump when running -checkblockindex after `loadtxoutset`
Github-Pull: #28791 Rebased-From: cdc6ac4126b31426261605a757c52ea2dbfb2a81
-rw-r--r--src/validation.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/validation.cpp b/src/validation.cpp
index a6cab6b095..5d435fef8b 100644
--- a/src/validation.cpp
+++ b/src/validation.cpp
@@ -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;