@@ -2199,13 +2199,11 @@ static void AppendWarning(bilingual_str& res, const bilingual_str& warn)
2199
2199
res += warn;
2200
2200
}
2201
2201
2202
- /* * Check warning conditions and do some notifications on new chain tip set. */
2203
- static void UpdateTip (CTxMemPool* mempool, const CBlockIndex* pindexNew, const CChainParams& chainParams, CChainState& active_chainstate)
2204
- EXCLUSIVE_LOCKS_REQUIRED(::cs_main)
2202
+ void CChainState::UpdateTip (const CBlockIndex* pindexNew)
2205
2203
{
2206
2204
// New best block
2207
- if (mempool ) {
2208
- mempool ->AddTransactionsUpdated (1 );
2205
+ if (m_mempool ) {
2206
+ m_mempool ->AddTransactionsUpdated (1 );
2209
2207
}
2210
2208
2211
2209
{
@@ -2215,11 +2213,11 @@ static void UpdateTip(CTxMemPool* mempool, const CBlockIndex* pindexNew, const C
2215
2213
}
2216
2214
2217
2215
bilingual_str warning_messages;
2218
- if (!active_chainstate. IsInitialBlockDownload ()) {
2216
+ if (!this -> IsInitialBlockDownload ()) {
2219
2217
const CBlockIndex* pindex = pindexNew;
2220
2218
for (int bit = 0 ; bit < VERSIONBITS_NUM_BITS; bit++) {
2221
2219
WarningBitsConditionChecker checker (bit);
2222
- ThresholdState state = checker.GetStateFor (pindex, chainParams .GetConsensus (), warningcache[bit]);
2220
+ ThresholdState state = checker.GetStateFor (pindex, m_params .GetConsensus (), warningcache[bit]);
2223
2221
if (state == ThresholdState::ACTIVE || state == ThresholdState::LOCKED_IN) {
2224
2222
const bilingual_str warning = strprintf (_ (" Unknown new rules activated (versionbit %i)" ), bit);
2225
2223
if (state == ThresholdState::ACTIVE) {
@@ -2234,7 +2232,7 @@ static void UpdateTip(CTxMemPool* mempool, const CBlockIndex* pindexNew, const C
2234
2232
pindexNew->GetBlockHash ().ToString (), pindexNew->nHeight , pindexNew->nVersion ,
2235
2233
log (pindexNew->nChainWork .getdouble ())/log (2.0 ), (unsigned long )pindexNew->nChainTx ,
2236
2234
FormatISO8601DateTime (pindexNew->GetBlockTime ()),
2237
- GuessVerificationProgress (chainParams .TxData (), pindexNew), active_chainstate. CoinsTip ().DynamicMemoryUsage () * (1.0 / (1 <<20 )), active_chainstate. CoinsTip ().GetCacheSize (),
2235
+ GuessVerificationProgress (m_params .TxData (), pindexNew), this -> CoinsTip ().DynamicMemoryUsage () * (1.0 / (1 <<20 )), this -> CoinsTip ().GetCacheSize (),
2238
2236
!warning_messages.empty () ? strprintf (" warning='%s'" , warning_messages.original ) : " " );
2239
2237
}
2240
2238
@@ -2292,7 +2290,7 @@ bool CChainState::DisconnectTip(BlockValidationState& state, DisconnectedBlockTr
2292
2290
2293
2291
m_chain.SetTip (pindexDelete->pprev );
2294
2292
2295
- UpdateTip (m_mempool, pindexDelete->pprev , m_params, * this );
2293
+ UpdateTip (pindexDelete->pprev );
2296
2294
// Let wallets know transactions went from 1-confirmed to
2297
2295
// 0-confirmed or conflicted:
2298
2296
GetMainSignals ().BlockDisconnected (pblock, pindexDelete);
@@ -2404,7 +2402,7 @@ bool CChainState::ConnectTip(BlockValidationState& state, CBlockIndex* pindexNew
2404
2402
}
2405
2403
// Update m_chain & related variables.
2406
2404
m_chain.SetTip (pindexNew);
2407
- UpdateTip (m_mempool, pindexNew, m_params, * this );
2405
+ UpdateTip (pindexNew);
2408
2406
2409
2407
int64_t nTime6 = GetTimeMicros (); nTimePostConnect += nTime6 - nTime5; nTimeTotal += nTime6 - nTime1;
2410
2408
LogPrint (BCLog::BENCH, " - Connect postprocess: %.2fms [%.2fs (%.2fms/blk)]\n " , (nTime6 - nTime5) * MILLI, nTimePostConnect * MICRO, nTimePostConnect * MILLI / nBlocksTotal);
0 commit comments