Skip to content

Commit 033477d

Browse files
committed
doc: fix checkblockindex comments
These exceptions are not related to situations specific to tests, but are required in general: Without the first check CheckBlockindex could fail for blocks where we only know the header. Without the second, it could fail when blocks are received out of order.
1 parent 651fb03 commit 033477d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/validation.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4865,9 +4865,9 @@ void ChainstateManager::CheckBlockIndex()
48654865
// Make sure nChainTx sum is correctly computed.
48664866
unsigned int prev_chain_tx = pindex->pprev ? pindex->pprev->nChainTx : 0;
48674867
assert((pindex->nChainTx == pindex->nTx + prev_chain_tx)
4868-
// For testing, allow transaction counts to be completely unset.
4868+
// Transaction may be completely unset - happens if only the header was accepted but the block hasn't been processed.
48694869
|| (pindex->nChainTx == 0 && pindex->nTx == 0)
4870-
// For testing, allow this nChainTx to be unset if previous is also unset.
4870+
// nChainTx may be unset, but nTx set (if a block has been accepted, but one of its predecessors hasn't been processed yet)
48714871
|| (pindex->nChainTx == 0 && prev_chain_tx == 0 && pindex->pprev)
48724872
// Transaction counts prior to snapshot are unknown.
48734873
|| pindex->IsAssumedValid());

0 commit comments

Comments
 (0)