message: validation: Pass in chainstate to UpdateTip
diff: @@ -2280,7 +2280,7 @@ static void AppendWarning(bilingual_str& res, const bilingual_str& warn)
  }
  /** Check warning conditions and do some notifications on new chain tip set. */
  -static void UpdateTip(CTxMemPool& mempool, const CBlockIndex* pindexNew, const CChainParams& chainParams)
  +static void UpdateTip(CTxMemPool& mempool, const CBlockIndex* pindexNew, const CChainParams& chainParams, CChainState& active_chainstate)
  EXCLUSIVE_LOCKS_REQUIRED(::cs_main)
  {
  // New best block
  @@ -2293,17 +2293,19 @@ static void UpdateTip(CTxMemPool& mempool, const CBlockIndex* pindexNew, const C
  }
  bilingual_str warning_messages;
  - if (!::ChainstateActive().IsInitialBlockDownload()) {
  + assert(std::addressof(::ChainstateActive()) == std::addressof(active_chainstate));
  + if (!active_chainstate.IsInitialBlockDownload()) {
  const CBlockIndex* pindex = pindexNew;
  }
  + assert(std::addressof(::ChainstateActive()) == std::addressof(active_chainstate));
  LogPrintf("%s: new best=%s height=%d version=0x%08x log2_trust=%.8g moneysupply=%s tx=%lu date='%s' progress=%f cache=%.1fMiB(%utxo)%s\n", __func__,
  pindexNew->GetBlockHash().ToString(), pindexNew->nHeight, pindexNew->nVersion,
  log(pindexNew->nChainTrust.getdouble())/log(2.0),
  FormatMoney(pindexNew->nMoneySupply),
  (unsigned long)pindexNew->nChainTx,
  FormatISO8601DateTime(pindexNew->GetBlockTime()),
  - GuessVerificationProgress(chainParams.TxData(), pindexNew), ::ChainstateActive().CoinsTip().DynamicMemoryUsage() * (1.0 / (1<<20)), ::ChainstateActive().CoinsTip().GetCacheSize(),
  + GuessVerificationProgress(chainParams.TxData(), pindexNew), active_chainstate.CoinsTip().DynamicMemoryUsage() * (1.0 / (1<<20)), active_chainstate.CoinsTip().GetCacheSize(),
  !warning_messages.empty() ? strprintf(" warning='%s'", warning_messages.original) : "");
  }
  @@ -2359,7 +2361,7 @@ bool CChainState::DisconnectTip(BlockValidationState& state, const CChainParams&
  m_chain.SetTip(pindexDelete->pprev);
  - UpdateTip(m_mempool, pindexDelete->pprev, chainparams);
  + UpdateTip(m_mempool, pindexDelete->pprev, chainparams, *this);
  // Let wallets know transactions went from 1-confirmed to
  // 0-confirmed or conflicted:
  GetMainSignals().BlockDisconnected(pblock, pindexDelete);
  @@ -2467,7 +2469,7 @@ bool CChainState::ConnectTip(BlockValidationState& state, const CChainParams& ch
  disconnectpool.removeForBlock(blockConnecting.vtx);
  // Update m_chain & related variables.
  m_chain.SetTip(pindexNew);
  - UpdateTip(m_mempool, pindexNew, chainparams);
  + UpdateTip(m_mempool, pindexNew, chainparams, *this);
  int64_t nTime6 = GetTimeMicros(); nTimePostConnect += nTime6 - nTime5; nTimeTotal += nTime6 - nTime1;
  LogPrint(BCLog::BENCH, " - Connect postprocess: %.2fms [%.2fs (%.2fms/blk)]\n", (nTime6 - nTime5) * MILLI, nTimePostConnect * MICRO, nTimePostConnect * MILLI / nBlocksTotal);
  