@@ -3705,7 +3705,10 @@ CBlockIndex * BlockManager::InsertBlockIndex(const uint256& hash)
37053705 return pindexNew;
37063706}
37073707
3708- bool BlockManager::LoadBlockIndex (const Consensus::Params& consensus_params, CBlockTreeDB& blocktree)
3708+ bool BlockManager::LoadBlockIndex (
3709+ const Consensus::Params& consensus_params,
3710+ CBlockTreeDB& blocktree,
3711+ std::set<CBlockIndex*, CBlockIndexWorkComparator>& block_index_candidates)
37093712{
37103713 if (!blocktree.LoadBlockIndexGuts (consensus_params, [this ](const uint256& hash) EXCLUSIVE_LOCKS_REQUIRED (cs_main) { return this ->InsertBlockIndex (hash); }))
37113714 return false ;
@@ -3743,8 +3746,9 @@ bool BlockManager::LoadBlockIndex(const Consensus::Params& consensus_params, CBl
37433746 pindex->nStatus |= BLOCK_FAILED_CHILD;
37443747 setDirtyBlockIndex.insert (pindex);
37453748 }
3746- if (pindex->IsValid (BLOCK_VALID_TRANSACTIONS) && (pindex->HaveTxsDownloaded () || pindex->pprev == nullptr ))
3747- ::ChainstateActive ().setBlockIndexCandidates.insert(pindex);
3749+ if (pindex->IsValid (BLOCK_VALID_TRANSACTIONS) && (pindex->HaveTxsDownloaded () || pindex->pprev == nullptr )) {
3750+ block_index_candidates.insert (pindex);
3751+ }
37483752 if (pindex->nStatus & BLOCK_FAILED_MASK && (!pindexBestInvalid || pindex->nChainWork > pindexBestInvalid->nChainWork ))
37493753 pindexBestInvalid = pindex;
37503754 if (pindex->pprev )
@@ -3769,7 +3773,8 @@ void BlockManager::Unload() {
37693773
37703774bool static LoadBlockIndexDB (const CChainParams& chainparams) EXCLUSIVE_LOCKS_REQUIRED(cs_main)
37713775{
3772- if (!g_blockman.LoadBlockIndex (chainparams.GetConsensus (), *pblocktree))
3776+ if (!g_blockman.LoadBlockIndex (
3777+ chainparams.GetConsensus (), *pblocktree, ::ChainstateActive ().setBlockIndexCandidates ))
37733778 return false ;
37743779
37753780 // Load block file info
0 commit comments