From 923c3ab25ad1f78caa41ab67a683ddd9f9b68a1c Mon Sep 17 00:00:00 2001 From: Ataraxia Date: Wed, 26 Nov 2025 19:34:11 +0530 Subject: [PATCH] clean up load chainstate function --- src/validation.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/validation.cpp b/src/validation.cpp index 4a03ab9a32fa..4d67d5d76459 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -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; } @@ -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()),