@@ -317,10 +317,6 @@ struct Peer {
317
317
{
318
318
return WITH_LOCK (m_tx_relay_mutex, return m_tx_relay.get ());
319
319
};
320
- const TxRelay* GetTxRelay () const EXCLUSIVE_LOCKS_REQUIRED(!m_tx_relay_mutex)
321
- {
322
- return WITH_LOCK (m_tx_relay_mutex, return m_tx_relay.get ());
323
- };
324
320
325
321
/* * A vector of addresses to send to the peer, limited to MAX_ADDR_TO_SEND. */
326
322
std::vector<CAddress> m_addrs_to_send GUARDED_BY (NetEventsInterface::g_msgproc_mutex);
@@ -908,7 +904,7 @@ class PeerManagerImpl final : public PeerManager
908
904
std::atomic<std::chrono::seconds> m_last_tip_update{0s};
909
905
910
906
/* * Determine whether or not a peer can request a transaction, and return it (or nullptr if not found or not allowed). */
911
- CTransactionRef FindTxForGetData (const Peer& peer , const GenTxid& gtxid, const std::chrono::seconds mempool_req, const std::chrono::seconds now)
907
+ CTransactionRef FindTxForGetData (const Peer::TxRelay& tx_relay , const GenTxid& gtxid, const std::chrono::seconds mempool_req, const std::chrono::seconds now)
912
908
EXCLUSIVE_LOCKS_REQUIRED(NetEventsInterface::g_msgproc_mutex);
913
909
914
910
void ProcessGetData (CNode& pfrom, Peer& peer, const std::atomic<bool >& interruptMsgProc)
@@ -2258,7 +2254,7 @@ void PeerManagerImpl::ProcessGetBlockData(CNode& pfrom, Peer& peer, const CInv&
2258
2254
}
2259
2255
}
2260
2256
2261
- CTransactionRef PeerManagerImpl::FindTxForGetData (const Peer& peer , const GenTxid& gtxid, const std::chrono::seconds mempool_req, const std::chrono::seconds now)
2257
+ CTransactionRef PeerManagerImpl::FindTxForGetData (const Peer::TxRelay& tx_relay , const GenTxid& gtxid, const std::chrono::seconds mempool_req, const std::chrono::seconds now)
2262
2258
{
2263
2259
auto txinfo = m_mempool.info (gtxid);
2264
2260
if (txinfo.tx ) {
@@ -2271,7 +2267,7 @@ CTransactionRef PeerManagerImpl::FindTxForGetData(const Peer& peer, const GenTxi
2271
2267
}
2272
2268
2273
2269
// Otherwise, the transaction must have been announced recently.
2274
- if (Assume (peer. GetTxRelay ())-> m_recently_announced_invs .contains (gtxid.GetHash ())) {
2270
+ if (tx_relay. m_recently_announced_invs .contains (gtxid.GetHash ())) {
2275
2271
// If it was, it can be relayed from either the mempool...
2276
2272
if (txinfo.tx ) return std::move (txinfo.tx );
2277
2273
// ... or the relay pool.
@@ -2313,7 +2309,7 @@ void PeerManagerImpl::ProcessGetData(CNode& pfrom, Peer& peer, const std::atomic
2313
2309
continue ;
2314
2310
}
2315
2311
2316
- CTransactionRef tx = FindTxForGetData (peer , ToGenTxid (inv), mempool_req, now);
2312
+ CTransactionRef tx = FindTxForGetData (*tx_relay , ToGenTxid (inv), mempool_req, now);
2317
2313
if (tx) {
2318
2314
// WTX and WITNESS_TX imply we serialize with witness
2319
2315
int nSendFlags = (inv.IsMsgTx () ? SERIALIZE_TRANSACTION_NO_WITNESS : 0 );
0 commit comments