Skip to content

Commit 5d67017

Browse files
committed
validation: Load pindexBestHeader in ChainMan
Now BlockManager::LoadBlockIndex() will ACTUALLY only load BlockMan members. [META] In a later commit, pindexBestHeader will be moved to ChainMan as a member ----- Code Reviewer Notes Call graph of relevant functions: ChainstateManager::LoadBlockIndex() <-- Moved to calls BlockManager::LoadBlockIndexDB() which calls BlockManager::LoadBlockIndex() <-- Moved from There is only one call to each of inner functions, meaning that no behavior is changing.
1 parent 2b5a741 commit 5d67017

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/node/blockstorage.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -285,8 +285,6 @@ bool BlockManager::LoadBlockIndex(const Consensus::Params& consensus_params)
285285
if (pindex->pprev) {
286286
pindex->BuildSkip();
287287
}
288-
if (pindex->IsValid(BLOCK_VALID_TREE) && (pindexBestHeader == nullptr || CBlockIndexWorkComparator()(pindexBestHeader, pindex)))
289-
pindexBestHeader = pindex;
290288
}
291289

292290
return true;

src/validation.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4203,6 +4203,8 @@ bool ChainstateManager::LoadBlockIndex()
42034203
if (pindex->nStatus & BLOCK_FAILED_MASK && (!m_best_invalid || pindex->nChainWork > m_best_invalid->nChainWork)) {
42044204
m_best_invalid = pindex;
42054205
}
4206+
if (pindex->IsValid(BLOCK_VALID_TREE) && (pindexBestHeader == nullptr || CBlockIndexWorkComparator()(pindexBestHeader, pindex)))
4207+
pindexBestHeader = pindex;
42064208
}
42074209

42084210
needs_init = m_blockman.m_block_index.empty();

0 commit comments

Comments
 (0)