@@ -236,7 +236,7 @@ namespace {
236
236
/* * When our tip was last updated. */
237
237
std::atomic<int64_t > g_last_tip_update (0 );
238
238
239
- /* * Relay map */
239
+ /* * Relay map (txid or wtxid -> CTransactionRef) */
240
240
typedef std::map<uint256, CTransactionRef> MapRelay;
241
241
MapRelay mapRelay GUARDED_BY (cs_main);
242
242
/* * Expiration-time ordered list of (expire time, relay map entry) pairs. */
@@ -1671,9 +1671,9 @@ void static ProcessGetBlockData(CNode& pfrom, const CChainParams& chainparams, c
1671
1671
}
1672
1672
1673
1673
// ! Determine whether or not a peer can request a transaction, and return it (or nullptr if not found or not allowed).
1674
- CTransactionRef static FindTxForGetData (const CNode& peer, const uint256& txid_or_wtxid, bool use_wtxid , const std::chrono::seconds mempool_req, const std::chrono::seconds now) LOCKS_EXCLUDED(cs_main)
1674
+ CTransactionRef static FindTxForGetData (const CNode& peer, const GenTxid& gtxid , const std::chrono::seconds mempool_req, const std::chrono::seconds now) LOCKS_EXCLUDED(cs_main)
1675
1675
{
1676
- auto txinfo = mempool.info (txid_or_wtxid, use_wtxid );
1676
+ auto txinfo = mempool.info (gtxid. GetHash (), gtxid. IsWtxid () );
1677
1677
if (txinfo.tx ) {
1678
1678
// If a TX could have been INVed in reply to a MEMPOOL request,
1679
1679
// or is older than UNCONDITIONAL_RELAY_DELAY, permit the request
@@ -1686,11 +1686,11 @@ CTransactionRef static FindTxForGetData(const CNode& peer, const uint256& txid_o
1686
1686
{
1687
1687
LOCK (cs_main);
1688
1688
// Otherwise, the transaction must have been announced recently.
1689
- if (State (peer.GetId ())->m_recently_announced_invs .contains (txid_or_wtxid )) {
1689
+ if (State (peer.GetId ())->m_recently_announced_invs .contains (gtxid. GetHash () )) {
1690
1690
// If it was, it can be relayed from either the mempool...
1691
1691
if (txinfo.tx ) return std::move (txinfo.tx );
1692
1692
// ... or the relay pool.
1693
- auto mi = mapRelay.find (txid_or_wtxid );
1693
+ auto mi = mapRelay.find (gtxid. GetHash () );
1694
1694
if (mi != mapRelay.end ()) return mi->second ;
1695
1695
}
1696
1696
}
@@ -1727,7 +1727,7 @@ void static ProcessGetData(CNode& pfrom, const CChainParams& chainparams, CConnm
1727
1727
continue ;
1728
1728
}
1729
1729
1730
- CTransactionRef tx = FindTxForGetData (pfrom, inv. hash , inv. IsMsgWtx ( ), mempool_req, now);
1730
+ CTransactionRef tx = FindTxForGetData (pfrom, ToGenTxid (inv ), mempool_req, now);
1731
1731
if (tx) {
1732
1732
// WTX and WITNESS_TX imply we serialize with witness
1733
1733
int nSendFlags = (inv.IsMsgTx () ? SERIALIZE_TRANSACTION_NO_WITNESS : 0 );
0 commit comments