From eaf6be0114a6d7763767da9496907fe8a670ff9e Mon Sep 17 00:00:00 2001 From: John Newbery Date: Mon, 23 Aug 2021 10:44:41 +0100 Subject: [PATCH] [net processing] Do not request transaction relay from feeler connections Add a test to verify that feeler connections do not request transaction relay. --- src/net_processing.cpp | 2 +- test/functional/p2p_add_connections.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/net_processing.cpp b/src/net_processing.cpp index 8be82f7ebc..bcc8bf1a2f 100644 --- a/src/net_processing.cpp +++ b/src/net_processing.cpp @@ -1096,7 +1096,7 @@ void PeerManagerImpl::PushNodeVersion(CNode& pnode, int64_t nTime) CService addr_you = addr.IsRoutable() && !IsProxy(addr) && addr.IsAddrV1Compatible() ? addr : CService(); uint64_t your_services{addr.nServices}; - const bool tx_relay = !m_ignore_incoming_txs && pnode.m_tx_relay != nullptr; + const bool tx_relay = !m_ignore_incoming_txs && pnode.m_tx_relay != nullptr && !pnode.IsFeelerConn(); m_connman.PushMessage(&pnode, CNetMsgMaker(INIT_PROTO_VERSION).Make(NetMsgType::VERSION, PROTOCOL_VERSION, my_services, nTime, your_services, addr_you, // Together the pre-version-31402 serialization of CAddress "addrYou" (without nTime) my_services, CService(), // Together the pre-version-31402 serialization of CAddress "addrMe" (without nTime) diff --git a/test/functional/p2p_add_connections.py b/test/functional/p2p_add_connections.py index 82674befeb..89ed2f857a 100755 --- a/test/functional/p2p_add_connections.py +++ b/test/functional/p2p_add_connections.py @@ -106,6 +106,8 @@ class P2PAddConnections(BitcoinTestFramework): # Verify version message received assert_equal(feeler_conn.message_count["version"], 1) + # Feeler connections do not request tx relay + assert_equal(feeler_conn.last_message["version"].relay, 0) if __name__ == '__main__': P2PAddConnections().main()