mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-21 15:50:07 +01:00
Move LoadBlockIndexDB to BlockManager
This commit is contained in:
@@ -3764,10 +3764,10 @@ void BlockManager::Unload() {
|
||||
m_block_index.clear();
|
||||
}
|
||||
|
||||
bool CChainState::LoadBlockIndexDB()
|
||||
bool BlockManager::LoadBlockIndexDB(std::set<CBlockIndex*, CBlockIndexWorkComparator>& setBlockIndexCandidates)
|
||||
{
|
||||
if (!m_blockman.LoadBlockIndex(
|
||||
m_params.GetConsensus(), *pblocktree,
|
||||
if (!LoadBlockIndex(
|
||||
::Params().GetConsensus(), *pblocktree,
|
||||
setBlockIndexCandidates)) {
|
||||
return false;
|
||||
}
|
||||
@@ -3792,7 +3792,7 @@ bool CChainState::LoadBlockIndexDB()
|
||||
// Check presence of blk files
|
||||
LogPrintf("Checking all blk files are present...\n");
|
||||
std::set<int> setBlkDataFiles;
|
||||
for (const std::pair<const uint256, CBlockIndex*>& item : m_blockman.m_block_index) {
|
||||
for (const std::pair<const uint256, CBlockIndex*>& item : m_block_index) {
|
||||
CBlockIndex* pindex = item.second;
|
||||
if (pindex->nStatus & BLOCK_HAVE_DATA) {
|
||||
setBlkDataFiles.insert(pindex->nFile);
|
||||
@@ -4114,7 +4114,7 @@ bool ChainstateManager::LoadBlockIndex()
|
||||
// Load block index from databases
|
||||
bool needs_init = fReindex;
|
||||
if (!fReindex) {
|
||||
bool ret = ActiveChainstate().LoadBlockIndexDB();
|
||||
bool ret = m_blockman.LoadBlockIndexDB(ActiveChainstate().setBlockIndexCandidates);
|
||||
if (!ret) return false;
|
||||
needs_init = m_blockman.m_block_index.empty();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user