message: validation: Pass in coins tip to CheckInputsFromMempoolAndCache
diff: @@ -397,7 +397,7 @@ static void UpdateMempoolForReorg(CTxMemPool& mempool, DisconnectedBlockTransact
  * */
  static bool CheckInputsFromMempoolAndCache(const CTransaction& tx, TxValidationState& state,
  const CCoinsViewCache& view, const CTxMemPool& pool,
  - unsigned int flags, PrecomputedTransactionData& txdata)
  + unsigned int flags, PrecomputedTransactionData& txdata, CCoinsViewCache& coins_tip)
  EXCLUSIVE_LOCKS_REQUIRED(cs_main, pool.cs)
  {
  AssertLockHeld(cs_main);
  @@ -422,7 +422,8 @@ static bool CheckInputsFromMempoolAndCache(const CTransaction& tx, TxValidationS
  assert(txFrom->vout.size() > txin.prevout.n);
  assert(txFrom->vout[txin.prevout.n] == coin.out);
  } else {
  - const Coin& coinFromUTXOSet = ::ChainstateActive().CoinsTip().AccessCoin(txin.prevout);
  + assert(std::addressof(::ChainstateActive().CoinsTip()) == std::addressof(coins_tip));
  + const Coin& coinFromUTXOSet = coins_tip.AccessCoin(txin.prevout);
  assert(!coinFromUTXOSet.IsSpent());
  assert(coinFromUTXOSet.out == coin.out);
  }
  @@ -784,7 +785,7 @@ bool MemPoolAccept::ConsensusScriptChecks(const ATMPArgs& args, Workspace& ws, P
  // invalid blocks (using TestBlockValidity), however allowing such
  // transactions into the mempool can be exploited as a DoS attack.
  unsigned int currentBlockScriptVerifyFlags = GetBlockScriptFlags(::ChainActive().Tip(), chainparams.GetConsensus());
  - if (!CheckInputsFromMempoolAndCache(tx, state, m_view, m_pool, currentBlockScriptVerifyFlags, txdata)) {
  + if (!CheckInputsFromMempoolAndCache(tx, state, m_view, m_pool, currentBlockScriptVerifyFlags, txdata, ::ChainstateActive().CoinsTip())) {
  return error("%s: BUG! PLEASE REPORT THIS! CheckInputScripts failed against latest-block but not STANDARD flags %s, %s",
  __func__, hash.ToString(), state.ToString());
  }
  