diff options
author | MacroFake <falke.marco@gmail.com> | 2022-10-04 16:20:22 +0200 |
---|---|---|
committer | MacroFake <falke.marco@gmail.com> | 2022-10-04 16:07:00 +0200 |
commit | dddd1acf58cb7bf328ce3e74d1dc0e8cbd503247 (patch) | |
tree | e7a477dc870b1b4077a7a22a55e617950f87945d | |
parent | 914c00074b62b911e16103254279beb5e3255429 (diff) |
net: Set relay in version msg to peers with relay permission
-rw-r--r-- | src/net_processing.cpp | 3 | ||||
-rwxr-xr-x | test/functional/p2p_blocksonly.py | 1 | ||||
-rwxr-xr-x | test/functional/test_framework/p2p.py | 1 |
3 files changed, 4 insertions, 1 deletions
diff --git a/src/net_processing.cpp b/src/net_processing.cpp index eca6263392..a753d9b1a8 100644 --- a/src/net_processing.cpp +++ b/src/net_processing.cpp @@ -1383,7 +1383,7 @@ void PeerManagerImpl::PushNodeVersion(CNode& pnode, const Peer& peer) 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.IsBlockOnlyConn() && !pnode.IsFeelerConn(); + const bool tx_relay{!RejectIncomingTxs(pnode)}; 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) @@ -5224,6 +5224,7 @@ bool PeerManagerImpl::RejectIncomingTxs(const CNode& peer) const { // block-relay-only peers may never send txs to us if (peer.IsBlockOnlyConn()) return true; + if (peer.IsFeelerConn()) return true; // In -blocksonly mode, peers need the 'relay' permission to send txs to us if (m_ignore_incoming_txs && !peer.HasPermission(NetPermissionFlags::Relay)) return true; return false; diff --git a/test/functional/p2p_blocksonly.py b/test/functional/p2p_blocksonly.py index 8ac38bff3a..231d2e12c9 100755 --- a/test/functional/p2p_blocksonly.py +++ b/test/functional/p2p_blocksonly.py @@ -57,6 +57,7 @@ class P2PBlocksOnly(BitcoinTestFramework): second_peer = self.nodes[0].add_p2p_connection(P2PInterface()) peer_1_info = self.nodes[0].getpeerinfo()[0] assert_equal(peer_1_info['permissions'], ['relay']) + assert_equal(first_peer.relay, 1) peer_2_info = self.nodes[0].getpeerinfo()[1] assert_equal(peer_2_info['permissions'], ['relay']) assert_equal(self.nodes[0].testmempoolaccept([tx_hex])[0]['allowed'], True) diff --git a/test/functional/test_framework/p2p.py b/test/functional/test_framework/p2p.py index fc72a9ab73..e96cc3fa7f 100755 --- a/test/functional/test_framework/p2p.py +++ b/test/functional/test_framework/p2p.py @@ -446,6 +446,7 @@ class P2PInterface(P2PConnection): self.send_message(msg_sendaddrv2()) self.send_message(msg_verack()) self.nServices = message.nServices + self.relay = message.relay self.send_message(msg_getaddr()) # Connection helper methods |