diff options
-rw-r--r-- | src/node/blockstorage.cpp | 2 | ||||
-rw-r--r-- | src/validation.cpp | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/src/node/blockstorage.cpp b/src/node/blockstorage.cpp index 763fd29744..45e7ca4796 100644 --- a/src/node/blockstorage.cpp +++ b/src/node/blockstorage.cpp @@ -285,8 +285,6 @@ bool BlockManager::LoadBlockIndex(const Consensus::Params& consensus_params) if (pindex->pprev) { pindex->BuildSkip(); } - if (pindex->IsValid(BLOCK_VALID_TREE) && (pindexBestHeader == nullptr || CBlockIndexWorkComparator()(pindexBestHeader, pindex))) - pindexBestHeader = pindex; } return true; diff --git a/src/validation.cpp b/src/validation.cpp index f4b316f67a..677159ddfe 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -4203,6 +4203,8 @@ bool ChainstateManager::LoadBlockIndex() if (pindex->nStatus & BLOCK_FAILED_MASK && (!m_best_invalid || pindex->nChainWork > m_best_invalid->nChainWork)) { m_best_invalid = pindex; } + if (pindex->IsValid(BLOCK_VALID_TREE) && (pindexBestHeader == nullptr || CBlockIndexWorkComparator()(pindexBestHeader, pindex))) + pindexBestHeader = pindex; } needs_init = m_blockman.m_block_index.empty(); |