@@ -2983,9 +2983,9 @@ void Chainstate::PruneAndFlush()
2983
2983
}
2984
2984
2985
2985
static void UpdateTipLog (
2986
+ const ChainstateManager& chainman,
2986
2987
const CCoinsViewCache& coins_tip,
2987
2988
const CBlockIndex* tip,
2988
- const CChainParams& params,
2989
2989
const std::string& func_name,
2990
2990
const std::string& prefix,
2991
2991
const std::string& warning_messages) EXCLUSIVE_LOCKS_REQUIRED(::cs_main)
@@ -2997,7 +2997,7 @@ static void UpdateTipLog(
2997
2997
tip->GetBlockHash ().ToString (), tip->nHeight , tip->nVersion ,
2998
2998
log (tip->nChainWork .getdouble ()) / log (2.0 ), tip->m_chain_tx_count ,
2999
2999
FormatISO8601DateTime (tip->GetBlockTime ()),
3000
- GuessVerificationProgress (params. TxData (), tip),
3000
+ chainman. GuessVerificationProgress (tip),
3001
3001
coins_tip.DynamicMemoryUsage () * (1.0 / (1 << 20 )),
3002
3002
coins_tip.GetCacheSize (),
3003
3003
!warning_messages.empty () ? strprintf (" warning='%s'" , warning_messages) : " " );
@@ -3008,15 +3008,13 @@ void Chainstate::UpdateTip(const CBlockIndex* pindexNew)
3008
3008
AssertLockHeld (::cs_main);
3009
3009
const auto & coins_tip = this ->CoinsTip ();
3010
3010
3011
- const CChainParams& params{m_chainman.GetParams ()};
3012
-
3013
3011
// The remainder of the function isn't relevant if we are not acting on
3014
3012
// the active chainstate, so return if need be.
3015
3013
if (this != &m_chainman.ActiveChainstate ()) {
3016
3014
// Only log every so often so that we don't bury log messages at the tip.
3017
3015
constexpr int BACKGROUND_LOG_INTERVAL = 2000 ;
3018
3016
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] " , " " );
3020
3018
}
3021
3019
return ;
3022
3020
}
@@ -3031,7 +3029,7 @@ void Chainstate::UpdateTip(const CBlockIndex* pindexNew)
3031
3029
const CBlockIndex* pindex = pindexNew;
3032
3030
for (int bit = 0 ; bit < VERSIONBITS_NUM_BITS; bit++) {
3033
3031
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));
3035
3033
if (state == ThresholdState::ACTIVE || state == ThresholdState::LOCKED_IN) {
3036
3034
const bilingual_str warning = strprintf (_ (" Unknown new rules activated (versionbit %i)" ), bit);
3037
3035
if (state == ThresholdState::ACTIVE) {
@@ -3042,7 +3040,7 @@ void Chainstate::UpdateTip(const CBlockIndex* pindexNew)
3042
3040
}
3043
3041
}
3044
3042
}
3045
- UpdateTipLog (coins_tip, pindexNew, params , __func__, " " ,
3043
+ UpdateTipLog (m_chainman, coins_tip, pindexNew , __func__, " " ,
3046
3044
util::Join (warning_messages, Untranslated (" , " )).original );
3047
3045
}
3048
3046
@@ -4720,7 +4718,7 @@ bool Chainstate::LoadChainTip()
4720
4718
tip->GetBlockHash ().ToString (),
4721
4719
m_chain.Height (),
4722
4720
FormatISO8601DateTime (tip->GetBlockTime ()),
4723
- GuessVerificationProgress ( m_chainman.GetParams (). TxData (), tip));
4721
+ m_chainman.GuessVerificationProgress ( tip));
4724
4722
4725
4723
// Ensure KernelNotifications m_tip_block is set even if no new block arrives.
4726
4724
if (this ->GetRole () != ChainstateRole::BACKGROUND) {
@@ -5611,9 +5609,12 @@ bool Chainstate::ResizeCoinsCaches(size_t coinstip_size, size_t coinsdb_size)
5611
5609
5612
5610
// ! Guess how far we are in the verification process at the given block index
5613
5611
// ! 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 ) {
5616
5616
return 0.0 ;
5617
+ }
5617
5618
5618
5619
if (!Assume (pindex->m_chain_tx_count > 0 )) {
5619
5620
LogWarning (" Internal bug detected: block %d has unset m_chain_tx_count (%s %s). Please report this issue here: %s\n " ,
0 commit comments