message: wallet: Properly set fInMempool in mempool notifications
diff: @@ -98,6 +98,16 @@ static void UpdateWalletSetting(interfaces::Chain& chain,
  }
  }
  +/**
  + * Refresh mempool status so the wallet is in an internally consistent state and
  + * immediately knows the transaction's status: Whether it can be considered
  + * trusted and is eligible to be abandoned ...
  + */
  +static void RefreshMempoolStatus(CWalletTx& tx, interfaces::Chain& chain)
  +{
  + tx.fInMempool = chain.isInMempool(tx.GetHash());
  +}
  +
  bool AddWallet(const std::shared_ptr<CWallet>& wallet)
  {
  LOCK(cs_wallets);
  @@ -1208,7 +1218,7 @@ void CWallet::transactionAddedToMempool(const CTransactionRef& tx, uint64_t memp
  auto it = mapWallet.find(tx->GetHash());
  if (it != mapWallet.end()) {
  - it->second.fInMempool = true;
  + RefreshMempoolStatus(it->second, chain());
  }
  }
  @@ -1216,7 +1226,7 @@ void CWallet::transactionRemovedFromMempool(const CTransactionRef& tx, MemPoolRe
  LOCK(cs_wallet);
  auto it = mapWallet.find(tx->GetHash());
  if (it != mapWallet.end()) {
  - it->second.fInMempool = false;
  + RefreshMempoolStatus(it->second, chain());
  }
  // Handle transactions that were removed from the mempool because they
  // conflict with transactions in a newly connected block.
  