@@ -4136,11 +4136,12 @@ void BlockManager::Unload() {
41364136 m_block_index.clear ();
41374137}
41384138
4139- bool static LoadBlockIndexDB (ChainstateManager& chainman, const CChainParams& chainparams) EXCLUSIVE_LOCKS_REQUIRED(cs_main )
4139+ bool CChainState:: LoadBlockIndexDB (const CChainParams& chainparams)
41404140{
4141- if (!chainman.m_blockman .LoadBlockIndex (
4141+ assert (std::addressof (::ChainstateActive ()) == std::addressof (*this ));
4142+ if (!m_blockman.LoadBlockIndex (
41424143 chainparams.GetConsensus (), *pblocktree,
4143- ::ChainstateActive (). setBlockIndexCandidates)) {
4144+ setBlockIndexCandidates)) {
41444145 return false ;
41454146 }
41464147
@@ -4164,7 +4165,7 @@ bool static LoadBlockIndexDB(ChainstateManager& chainman, const CChainParams& ch
41644165 // Check presence of blk files
41654166 LogPrintf (" Checking all blk files are present...\n " );
41664167 std::set<int > setBlkDataFiles;
4167- for (const std::pair<const uint256, CBlockIndex*>& item : chainman. BlockIndex () ) {
4168+ for (const std::pair<const uint256, CBlockIndex*>& item : m_blockman. m_block_index ) {
41684169 CBlockIndex* pindex = item.second ;
41694170 if (pindex->nStatus & BLOCK_HAVE_DATA) {
41704171 setBlkDataFiles.insert (pindex->nFile );
@@ -4596,7 +4597,7 @@ bool ChainstateManager::LoadBlockIndex(const CChainParams& chainparams)
45964597 // Load block index from databases
45974598 bool needs_init = fReindex ;
45984599 if (!fReindex ) {
4599- bool ret = LoadBlockIndexDB (* this , chainparams);
4600+ bool ret = ActiveChainstate (). LoadBlockIndexDB (chainparams);
46004601 if (!ret) return false ;
46014602 needs_init = m_blockman.m_block_index .empty ();
46024603 }
0 commit comments