Skip to content

Commit 5a80773

Browse files
committed
validation: insert assumed-valid block index entries into candidates
1 parent 01a9b8f commit 5a80773

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

src/validation.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3773,7 +3773,9 @@ bool BlockManager::LoadBlockIndex(
37733773
pindex->nStatus |= BLOCK_FAILED_CHILD;
37743774
setDirtyBlockIndex.insert(pindex);
37753775
}
3776-
if (pindex->IsValid(BLOCK_VALID_TRANSACTIONS) && (pindex->HaveTxsDownloaded() || pindex->pprev == nullptr)) {
3776+
if (pindex->IsAssumedValid() ||
3777+
(pindex->IsValid(BLOCK_VALID_TRANSACTIONS) &&
3778+
(pindex->HaveTxsDownloaded() || pindex->pprev == nullptr))) {
37773779
block_index_candidates.insert(pindex);
37783780
}
37793781
if (pindex->nStatus & BLOCK_FAILED_MASK && (!pindexBestInvalid || pindex->nChainWork > pindexBestInvalid->nChainWork))

src/validation.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -647,9 +647,10 @@ class CChainState
647647
const std::optional<uint256> m_from_snapshot_blockhash;
648648

649649
/**
650-
* The set of all CBlockIndex entries with BLOCK_VALID_TRANSACTIONS (for itself and all ancestors) and
651-
* as good as our current tip or better. Entries may be failed, though, and pruning nodes may be
652-
* missing the data for the block.
650+
* The set of all CBlockIndex entries with either BLOCK_VALID_TRANSACTIONS (for
651+
* itself and all ancestors) *or* BLOCK_ASSUMED_VALID (if using background
652+
* chainstates) and as good as our current tip or better. Entries may be failed,
653+
* though, and pruning nodes may be missing the data for the block.
653654
*/
654655
std::set<CBlockIndex*, CBlockIndexWorkComparator> setBlockIndexCandidates;
655656

0 commit comments

Comments
 (0)