merge bitcoin#26396: Avoid SetTxRelay for feeler connections

continuation of dash#6365

includes:
- fa24239a (changes to `p2p_sendtxrcncl.py`)
This commit is contained in:
Kittywhiskers Van Gogh 2022-10-26 18:17:01 +02:00
parent 62dc9cb17b
commit 36be978fc9
No known key found for this signature in database
GPG Key ID: 30CD0C065E5C4AAD

View File

@ -34,6 +34,12 @@ class SendTxrcnclReceiver(P2PInterface):
def on_sendtxrcncl(self, message): def on_sendtxrcncl(self, message):
self.sendtxrcncl_msg_received = message self.sendtxrcncl_msg_received = message
class P2PFeelerReceiver(SendTxrcnclReceiver):
def on_version(self, message):
pass # feeler connections can not send any message other than their own version
class PeerTrackMsgOrder(P2PInterface): class PeerTrackMsgOrder(P2PInterface):
def __init__(self): def __init__(self):
super().__init__() super().__init__()
@ -151,6 +157,11 @@ class SendTxRcnclTest(BitcoinTestFramework):
assert not peer.sendtxrcncl_msg_received assert not peer.sendtxrcncl_msg_received
peer.peer_disconnect() peer.peer_disconnect()
self.log.info("SENDTXRCNCL should not be sent if feeler")
peer = self.nodes[0].add_outbound_p2p_connection(P2PFeelerReceiver(), p2p_idx=2, connection_type="feeler")
assert not peer.sendtxrcncl_msg_received
peer.peer_disconnect()
self.log.info('SENDTXRCNCL if block-relay-only triggers a disconnect') self.log.info('SENDTXRCNCL if block-relay-only triggers a disconnect')
peer = self.nodes[0].add_outbound_p2p_connection( peer = self.nodes[0].add_outbound_p2p_connection(
PeerNoVerack(), wait_for_verack=False, p2p_idx=3, connection_type="block-relay-only") PeerNoVerack(), wait_for_verack=False, p2p_idx=3, connection_type="block-relay-only")