Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions src/validation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5039,16 +5039,16 @@ void PruneBlockFilesManual(Chainstate& active_chainstate, int nManualPruneHeight
bool Chainstate::LoadChainTip()
{
AssertLockHeld(cs_main);
const CCoinsViewCache& coins_cache = CoinsTip();
assert(!coins_cache.GetBestBlock().IsNull()); // Never called when the coins view is empty
uint256 coins_view_best_block_hash = CoinsTip().GetBestBlock();
assert(!coins_view_best_block_hash.IsNull()); // Never called when the coins view is empty
CBlockIndex* tip = m_chain.Tip();

if (tip && tip->GetBlockHash() == coins_cache.GetBestBlock()) {
if (tip && tip->GetBlockHash() == coins_view_best_block_hash) {
return true;
}

// Load pointer to end of best chain
CBlockIndex* pindex = m_blockman.LookupBlockIndex(coins_cache.GetBestBlock());
CBlockIndex* pindex = m_blockman.LookupBlockIndex(coins_view_best_block_hash);
if (!pindex) {
return false;
}
Expand All @@ -5067,8 +5067,7 @@ bool Chainstate::LoadChainTip()
}
PruneBlockIndexCandidates();

tip = m_chain.Tip();
LogPrintf("Loaded best chain: hashBestChain=%s height=%d date=%s progress=%f\n",
LogInfo("Loaded best chain: hashBestChain=%s height=%d date=%s progress=%f",
tip->GetBlockHash().ToString(),
m_chain.Height(),
FormatISO8601DateTime(tip->GetBlockTime()),
Expand Down