From 6a37934af46c15e3811690a7cad54e969c0ff15d Mon Sep 17 00:00:00 2001 From: Kittywhiskers Van Gogh <63189531+kwvg@users.noreply.github.com> Date: Wed, 26 Oct 2022 18:17:01 +0200 Subject: [PATCH] partial bitcoin#26396: Avoid SetTxRelay for feeler connections excludes: - fa24239a (changes to `p2p_sendtxrcncl.py`) --- src/net.h | 6 ++---- src/net_processing.cpp | 6 +++--- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/net.h b/src/net.h index 1691f6f8d5..8a36625827 100644 --- a/src/net.h +++ b/src/net.h @@ -929,10 +929,8 @@ public: /** Whether this peer provides all services that we want. Used for eviction decisions */ std::atomic_bool m_has_all_wanted_services{false}; - /** Whether we should relay transactions to this peer (their version - * message did not include fRelay=false and this is not a block-relay-only - * connection). This only changes from false to true. It will never change - * back to false. Used only in inbound eviction logic. */ + /** Whether we should relay transactions to this peer. This only changes + * from false to true. It will never change back to false. */ std::atomic_bool m_relays_txs{false}; /** Whether this peer has loaded a bloom filter. Used only in inbound diff --git a/src/net_processing.cpp b/src/net_processing.cpp index e439f15f7c..3c8cef6a28 100644 --- a/src/net_processing.cpp +++ b/src/net_processing.cpp @@ -399,9 +399,7 @@ private: Mutex m_tx_relay_mutex; /** Transaction relay data. - * (Bitcoin) Will be a nullptr if we're not relaying transactions with this peer - * (e.g. if it's a block-relay-only peer). Users should access this with - * the GetTxRelay() getter. + * (Bitcoin) Transaction relay data. May be a nullptr. * (Dash) Always initialized but selectively available through GetTxRelay() * (non-transaction relay should use GetInvRelay(), which will provide * unconditional access) */ @@ -3523,9 +3521,11 @@ void PeerManagerImpl::ProcessMessage( // We only initialize the m_tx_relay data structure if: // - this isn't an outbound block-relay-only connection; and + // - this isn't an outbound feeler connection, and // - fRelay=true or we're offering NODE_BLOOM to this peer // (NODE_BLOOM means that the peer may turn on tx relay later) if (!pfrom.IsBlockOnlyConn() && + !pfrom.IsFeelerConn() && (fRelay || (peer->m_our_services & NODE_BLOOM))) { auto* const tx_relay = peer->SetTxRelay(); {