51
51
#include < optional>
52
52
#include < typeinfo>
53
53
54
- /* * How long to cache transactions in mapRelay for normal relay */
55
- static constexpr auto RELAY_TX_CACHE_TIME = 15min;
56
- /* * How long a transaction has to be in the mempool before it can unconditionally be relayed (even when not in mapRelay). */
54
+ /* * How long a transaction has to be in the mempool before it can unconditionally be relayed. */
57
55
static constexpr auto UNCONDITIONAL_RELAY_DELAY = 2min;
58
56
/* * Headers download timeout.
59
57
* Timeout = base + per_header * (expected number of headers) */
@@ -920,12 +918,6 @@ class PeerManagerImpl final : public PeerManager
920
918
/* * Process a new block. Perform any post-processing housekeeping */
921
919
void ProcessBlock (CNode& node, const std::shared_ptr<const CBlock>& block, bool force_processing, bool min_pow_checked);
922
920
923
- /* * Relay map (txid or wtxid -> CTransactionRef) */
924
- typedef std::map<uint256, CTransactionRef> MapRelay;
925
- MapRelay mapRelay GUARDED_BY (NetEventsInterface::g_msgproc_mutex);
926
- /* * Expiration-time ordered list of (expire time, relay map entry) pairs. */
927
- std::deque<std::pair<std::chrono::microseconds, MapRelay::iterator>> g_relay_expiration GUARDED_BY (NetEventsInterface::g_msgproc_mutex);
928
-
929
921
/* *
930
922
* When a peer sends us a valid block, instruct it to announce blocks to us
931
923
* using CMPCTBLOCK if possible by adding its nodeid to the end of
@@ -2322,12 +2314,6 @@ CTransactionRef PeerManagerImpl::FindTxForGetData(const Peer::TxRelay& tx_relay,
2322
2314
}
2323
2315
}
2324
2316
2325
- // Or it might be recent and in the relay pool.
2326
- if (recent) {
2327
- auto mi = mapRelay.find (gtxid.GetHash ());
2328
- if (mi != mapRelay.end ()) return mi->second ;
2329
- }
2330
-
2331
2317
return {};
2332
2318
}
2333
2319
@@ -5796,7 +5782,6 @@ bool PeerManagerImpl::SendMessages(CNode* pto)
5796
5782
continue ;
5797
5783
}
5798
5784
auto txid = txinfo.tx ->GetHash ();
5799
- auto wtxid = txinfo.tx ->GetWitnessHash ();
5800
5785
// Peer told you to not send transactions at that feerate? Don't bother sending it.
5801
5786
if (txinfo.fee < filterrate.GetFee (txinfo.vsize )) {
5802
5787
continue ;
@@ -5806,24 +5791,6 @@ bool PeerManagerImpl::SendMessages(CNode* pto)
5806
5791
tx_relay->m_recently_announced_invs .insert (hash);
5807
5792
vInv.push_back (inv);
5808
5793
nRelayedTransactions++;
5809
- {
5810
- // Expire old relay messages
5811
- while (!g_relay_expiration.empty () && g_relay_expiration.front ().first < current_time)
5812
- {
5813
- mapRelay.erase (g_relay_expiration.front ().second );
5814
- g_relay_expiration.pop_front ();
5815
- }
5816
-
5817
- auto ret = mapRelay.emplace (txid, std::move (txinfo.tx ));
5818
- if (ret.second ) {
5819
- g_relay_expiration.emplace_back (current_time + RELAY_TX_CACHE_TIME, ret.first );
5820
- }
5821
- // Add wtxid-based lookup into mapRelay as well, so that peers can request by wtxid
5822
- auto ret2 = mapRelay.emplace (wtxid, ret.first ->second );
5823
- if (ret2.second ) {
5824
- g_relay_expiration.emplace_back (current_time + RELAY_TX_CACHE_TIME, ret2.first );
5825
- }
5826
- }
5827
5794
if (vInv.size () == MAX_INV_SZ) {
5828
5795
m_connman.PushMessage (pto, msgMaker.Make (NetMsgType::INV, vInv));
5829
5796
vInv.clear ();
0 commit comments