@@ -3705,7 +3705,10 @@ CBlockIndex * BlockManager::InsertBlockIndex(const uint256& hash)
3705
3705
return pindexNew;
3706
3706
}
3707
3707
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)
3709
3712
{
3710
3713
if (!blocktree.LoadBlockIndexGuts (consensus_params, [this ](const uint256& hash) EXCLUSIVE_LOCKS_REQUIRED (cs_main) { return this ->InsertBlockIndex (hash); }))
3711
3714
return false ;
@@ -3743,8 +3746,9 @@ bool BlockManager::LoadBlockIndex(const Consensus::Params& consensus_params, CBl
3743
3746
pindex->nStatus |= BLOCK_FAILED_CHILD;
3744
3747
setDirtyBlockIndex.insert (pindex);
3745
3748
}
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
+ }
3748
3752
if (pindex->nStatus & BLOCK_FAILED_MASK && (!pindexBestInvalid || pindex->nChainWork > pindexBestInvalid->nChainWork ))
3749
3753
pindexBestInvalid = pindex;
3750
3754
if (pindex->pprev )
@@ -3769,7 +3773,8 @@ void BlockManager::Unload() {
3769
3773
3770
3774
bool static LoadBlockIndexDB (const CChainParams& chainparams) EXCLUSIVE_LOCKS_REQUIRED(cs_main)
3771
3775
{
3772
- if (!g_blockman.LoadBlockIndex (chainparams.GetConsensus (), *pblocktree))
3776
+ if (!g_blockman.LoadBlockIndex (
3777
+ chainparams.GetConsensus (), *pblocktree, ::ChainstateActive ().setBlockIndexCandidates ))
3773
3778
return false ;
3774
3779
3775
3780
// Load block file info
0 commit comments