@@ -2983,9 +2983,9 @@ void Chainstate::PruneAndFlush()
29832983}
29842984
29852985static void UpdateTipLog (
2986+ const ChainstateManager& chainman,
29862987 const CCoinsViewCache& coins_tip,
29872988 const CBlockIndex* tip,
2988- const CChainParams& params,
29892989 const std::string& func_name,
29902990 const std::string& prefix,
29912991 const std::string& warning_messages) EXCLUSIVE_LOCKS_REQUIRED(::cs_main)
@@ -2997,7 +2997,7 @@ static void UpdateTipLog(
29972997 tip->GetBlockHash ().ToString (), tip->nHeight , tip->nVersion ,
29982998 log (tip->nChainWork .getdouble ()) / log (2.0 ), tip->m_chain_tx_count ,
29992999 FormatISO8601DateTime (tip->GetBlockTime ()),
3000- GuessVerificationProgress (params. TxData (), tip),
3000+ chainman. GuessVerificationProgress (tip),
30013001 coins_tip.DynamicMemoryUsage () * (1.0 / (1 << 20 )),
30023002 coins_tip.GetCacheSize (),
30033003 !warning_messages.empty () ? strprintf (" warning='%s'" , warning_messages) : " " );
@@ -3008,15 +3008,13 @@ void Chainstate::UpdateTip(const CBlockIndex* pindexNew)
30083008 AssertLockHeld (::cs_main);
30093009 const auto & coins_tip = this ->CoinsTip ();
30103010
3011- const CChainParams& params{m_chainman.GetParams ()};
3012-
30133011 // The remainder of the function isn't relevant if we are not acting on
30143012 // the active chainstate, so return if need be.
30153013 if (this != &m_chainman.ActiveChainstate ()) {
30163014 // Only log every so often so that we don't bury log messages at the tip.
30173015 constexpr int BACKGROUND_LOG_INTERVAL = 2000 ;
30183016 if (pindexNew->nHeight % BACKGROUND_LOG_INTERVAL == 0 ) {
3019- UpdateTipLog (coins_tip, pindexNew, params , __func__, " [background validation] " , " " );
3017+ UpdateTipLog (m_chainman, coins_tip, pindexNew , __func__, " [background validation] " , " " );
30203018 }
30213019 return ;
30223020 }
@@ -3031,7 +3029,7 @@ void Chainstate::UpdateTip(const CBlockIndex* pindexNew)
30313029 const CBlockIndex* pindex = pindexNew;
30323030 for (int bit = 0 ; bit < VERSIONBITS_NUM_BITS; bit++) {
30333031 WarningBitsConditionChecker checker (m_chainman, bit);
3034- ThresholdState state = checker.GetStateFor (pindex, params .GetConsensus (), m_chainman.m_warningcache .at (bit));
3032+ ThresholdState state = checker.GetStateFor (pindex, m_chainman .GetConsensus (), m_chainman.m_warningcache .at (bit));
30353033 if (state == ThresholdState::ACTIVE || state == ThresholdState::LOCKED_IN) {
30363034 const bilingual_str warning = strprintf (_ (" Unknown new rules activated (versionbit %i)" ), bit);
30373035 if (state == ThresholdState::ACTIVE) {
@@ -3042,7 +3040,7 @@ void Chainstate::UpdateTip(const CBlockIndex* pindexNew)
30423040 }
30433041 }
30443042 }
3045- UpdateTipLog (coins_tip, pindexNew, params , __func__, " " ,
3043+ UpdateTipLog (m_chainman, coins_tip, pindexNew , __func__, " " ,
30463044 util::Join (warning_messages, Untranslated (" , " )).original );
30473045}
30483046
@@ -4720,7 +4718,7 @@ bool Chainstate::LoadChainTip()
47204718 tip->GetBlockHash ().ToString (),
47214719 m_chain.Height (),
47224720 FormatISO8601DateTime (tip->GetBlockTime ()),
4723- GuessVerificationProgress ( m_chainman.GetParams (). TxData (), tip));
4721+ m_chainman.GuessVerificationProgress ( tip));
47244722
47254723 // Ensure KernelNotifications m_tip_block is set even if no new block arrives.
47264724 if (this ->GetRole () != ChainstateRole::BACKGROUND) {
@@ -5611,9 +5609,12 @@ bool Chainstate::ResizeCoinsCaches(size_t coinstip_size, size_t coinsdb_size)
56115609
56125610// ! Guess how far we are in the verification process at the given block index
56135611// ! require cs_main if pindex has not been validated yet (because m_chain_tx_count might be unset)
5614- double GuessVerificationProgress (const ChainTxData& data, const CBlockIndex *pindex) {
5615- if (pindex == nullptr )
5612+ double ChainstateManager::GuessVerificationProgress (const CBlockIndex* pindex) const
5613+ {
5614+ const ChainTxData& data{GetParams ().TxData ()};
5615+ if (pindex == nullptr ) {
56165616 return 0.0 ;
5617+ }
56175618
56185619 if (!Assume (pindex->m_chain_tx_count > 0 )) {
56195620 LogWarning (" Internal bug detected: block %d has unset m_chain_tx_count (%s %s). Please report this issue here: %s\n " ,
0 commit comments