diff options
author | MacroFake <falke.marco@gmail.com> | 2022-10-26 18:17:01 +0200 |
---|---|---|
committer | MacroFake <falke.marco@gmail.com> | 2022-10-27 16:09:33 +0200 |
commit | fa24239a1c2281f61ab70a62228e88f4c7e72701 (patch) | |
tree | 951be203a8cbc6d4a84149d4aea11f2d45c165bc /src | |
parent | ec92d23fb8922c37f678589d743ca214f966cd75 (diff) | |
download | bitcoin-fa24239a1c2281f61ab70a62228e88f4c7e72701.tar.xz |
net: Avoid SetTxRelay for feeler connections
Diffstat (limited to 'src')
-rw-r--r-- | src/net.h | 6 | ||||
-rw-r--r-- | src/net_processing.cpp | 8 |
2 files changed, 6 insertions, 8 deletions
@@ -489,10 +489,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 363f2fde71..18992a6fb2 100644 --- a/src/net_processing.cpp +++ b/src/net_processing.cpp @@ -395,9 +395,7 @@ struct Peer { private: Mutex m_tx_relay_mutex; - /** Transaction relay data. Will be a nullptr if we're not relaying - * transactions with this peer (e.g. if it's a block-relay-only peer or - * the peer has sent us fRelay=false with bloom filters disabled). */ + /** Transaction relay data. May be a nullptr. */ std::unique_ptr<TxRelay> m_tx_relay GUARDED_BY(m_tx_relay_mutex); }; @@ -3261,12 +3259,14 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type, } peer->m_starting_height = starting_height; - // We only initialize the Peer::TxRelay m_relay_txs data structure if: + // Only initialize the Peer::TxRelay m_relay_txs data structure if: // - this isn't an outbound block-relay-only connection, and + // - this isn't an outbound feeler connection, and // - fRelay=true (the peer wishes to receive transaction announcements) // or we're offering NODE_BLOOM to this peer. NODE_BLOOM means that // the peer may turn on transaction relay later. if (!pfrom.IsBlockOnlyConn() && + !pfrom.IsFeelerConn() && (fRelay || (peer->m_our_services & NODE_BLOOM))) { auto* const tx_relay = peer->SetTxRelay(); { |