message: lock annotations for MemPoolAccept functions
  We should already have the mempool lock when entering
  CheckInputsFromMempoolAndCache
diff: @@ -389,21 +389,17 @@ static void UpdateMempoolForReorg(CTxMemPool& mempool, DisconnectedBlockTransact
  // Used to avoid mempool polluting consensus critical paths if CCoinsViewMempool
  // were somehow broken and returning the wrong scriptPubKeys
  static bool CheckInputsFromMempoolAndCache(const CTransaction& tx, TxValidationState& state, const CCoinsViewCache& view, const CTxMemPool& pool,
  - unsigned int flags, PrecomputedTransactionData& txdata) EXCLUSIVE_LOCKS_REQUIRED(cs_main) {
  + unsigned int flags, PrecomputedTransactionData& txdata) EXCLUSIVE_LOCKS_REQUIRED(cs_main, pool.cs) {
  AssertLockHeld(cs_main);
  -
  - // pool.cs should be locked already, but go ahead and re-take the lock here
  - // to enforce that mempool doesn't change between when we check the view
  - // and when we actually call through to CheckInputScripts
  - LOCK(pool.cs);
  + AssertLockHeld(pool.cs);
  assert(!tx.IsCoinBase() && !tx.IsCoinStake());
  for (const CTxIn& txin : tx.vin) {
  const Coin& coin = view.AccessCoin(txin.prevout);
  - // AcceptToMemoryPoolWorker has already checked that the coins are
  - // available, so this shouldn't fail. If the inputs are not available
  - // here then return false.
  + // This coin was checked in PreChecks and MemPoolAccept
  + // has been holding cs_main since then.
  + Assume(!coin.IsSpent());
  if (coin.IsSpent()) return false;
  // Check equivalence for available inputs.
  @@ -483,13 +479,13 @@ private:
  // Run the script checks using our policy flags. As this can be slow, we should
  // only invoke this on transactions that have otherwise passed policy checks.
  - bool PolicyScriptChecks(ATMPArgs& args, const Workspace& ws, PrecomputedTransactionData& txdata) EXCLUSIVE_LOCKS_REQUIRED(cs_main);
  + bool PolicyScriptChecks(ATMPArgs& args, const Workspace& ws, PrecomputedTransactionData& txdata) EXCLUSIVE_LOCKS_REQUIRED(cs_main, m_pool.cs);
  // Re-run the script checks, using consensus flags, and try to cache the
  // result in the scriptcache. This should be done after
  // PolicyScriptChecks(). This requires that all inputs either be in our
  // utxo set or in the mempool.
  - bool ConsensusScriptChecks(ATMPArgs& args, const Workspace& ws, PrecomputedTransactionData &txdata) EXCLUSIVE_LOCKS_REQUIRED(cs_main);
  + bool ConsensusScriptChecks(ATMPArgs& args, const Workspace& ws, PrecomputedTransactionData &txdata) EXCLUSIVE_LOCKS_REQUIRED(cs_main, m_pool.cs);
  // Try to add the transaction to the mempool, removing any conflicts first.
  // Returns true if the transaction is in the mempool after any size
  