message: net_processing: move FindTxForGetData and ProcessGetData to PeerManagerImpl
  Allows making mapRelay and vRelayExpiration members rather than globals.
diff: @@ -442,6 +442,19 @@ private:
  /** When our tip was last updated. */
  std::atomic<int64_t> m_last_tip_update{0};
  +
  + /** Determine whether or not a peer can request a transaction, and return it (or nullptr if not found or not allowed). */
  + CTransactionRef FindTxForGetData(const CTxMemPool& mempool, const CNode& peer, const GenTxid& gtxid, const std::chrono::seconds mempool_req, const std::chrono::seconds now) LOCKS_EXCLUDED(cs_main);
  +
  + void ProcessGetData(CNode& pfrom, Peer& peer, const CChainParams& chainparams, CConnman& connman, CTxMemPool& mempool, const std::atomic<bool>& interruptMsgProc) EXCLUSIVE_LOCKS_REQUIRED(!cs_main, peer.m_getdata_requests_mutex);
  +
  + /** Relay map (txid or wtxid -> CTransactionRef) */
  + typedef std::map<uint256, CTransactionRef> MapRelay;
  + MapRelay mapRelay GUARDED_BY(cs_main);
  + /** Expiration-time ordered list of (expire time, relay map entry) pairs. */
  + std::deque<std::pair<int64_t, MapRelay::iterator>> vRelayExpiration GUARDED_BY(cs_main);
  +
  +
  };
  } // namespace
  @@ -462,12 +475,6 @@ namespace {
  /** Number of peers from which we're downloading blocks. */
  int nPeersWithValidatedDownloads GUARDED_BY(cs_main) = 0;
  - /** Relay map (txid or wtxid -> CTransactionRef) */
  - typedef std::map<uint256, CTransactionRef> MapRelay;
  - MapRelay mapRelay GUARDED_BY(cs_main);
  - /** Expiration-time ordered list of (expire time, relay map entry) pairs. */
  - std::deque<std::pair<int64_t, MapRelay::iterator>> vRelayExpiration GUARDED_BY(cs_main);
  -
  struct IteratorComparator
  {
  template<typename I>
  @@ -1852,8 +1859,7 @@ void static ProcessGetBlockData(CNode& pfrom, Peer& peer, const CChainParams& ch
  }
  }
  -//! Determine whether or not a peer can request a transaction, and return it (or nullptr if not found or not allowed).
  -static CTransactionRef FindTxForGetData(const CTxMemPool& mempool, const CNode& peer, const GenTxid& gtxid, const std::chrono::seconds mempool_req, const std::chrono::seconds now) LOCKS_EXCLUDED(cs_main)
  +CTransactionRef PeerManagerImpl::FindTxForGetData(const CTxMemPool& mempool, const CNode& peer, const GenTxid& gtxid, const std::chrono::seconds mempool_req, const std::chrono::seconds now) LOCKS_EXCLUDED(cs_main)
  {
  auto txinfo = mempool.info(gtxid);
  if (txinfo.tx) {
  @@ -1880,7 +1886,7 @@ static CTransactionRef FindTxForGetData(const CTxMemPool& mempool, const CNode&
  return {};
  }
  -void static ProcessGetData(CNode& pfrom, Peer& peer, const CChainParams& chainparams, CConnman& connman, CTxMemPool& mempool, const std::atomic<bool>& interruptMsgProc) EXCLUSIVE_LOCKS_REQUIRED(!cs_main, peer.m_getdata_requests_mutex)
  +void PeerManagerImpl::ProcessGetData(CNode& pfrom, Peer& peer, const CChainParams& chainparams, CConnman& connman, CTxMemPool& mempool, const std::atomic<bool>& interruptMsgProc) EXCLUSIVE_LOCKS_REQUIRED(!cs_main, peer.m_getdata_requests_mutex)
  {
  AssertLockNotHeld(cs_main);
  