aboutsummaryrefslogtreecommitdiff
path: root/test/functional/test_framework/p2p.py
diff options
context:
space:
mode:
authorAntoine Riard <ariard@student.42.fr>2020-10-17 11:20:43 -0400
committerAntoine Riard <ariard@student.42.fr>2020-11-02 18:29:48 -0500
commita07910abcd580ed07187794cf0e1faf040bb4212 (patch)
tree7aaccfd1610cf2300eb6f80bac8bfd94de66b5b9 /test/functional/test_framework/p2p.py
parent9e8d2bd076d78ba59abceb80106f44fe26246b14 (diff)
test: Makes wtxidrelay support a generic P2PInterface option
Its usage is extended beyond p2p_segwit.py in next commit.
Diffstat (limited to 'test/functional/test_framework/p2p.py')
-rwxr-xr-xtest/functional/test_framework/p2p.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/test/functional/test_framework/p2p.py b/test/functional/test_framework/p2p.py
index 6846d31221..0827e906d6 100755
--- a/test/functional/test_framework/p2p.py
+++ b/test/functional/test_framework/p2p.py
@@ -289,7 +289,7 @@ class P2PInterface(P2PConnection):
Individual testcases should subclass this and override the on_* methods
if they want to alter message handling behaviour."""
- def __init__(self, support_addrv2=False):
+ def __init__(self, support_addrv2=False, wtxidrelay=True):
super().__init__()
# Track number of messages of each type received.
@@ -309,6 +309,9 @@ class P2PInterface(P2PConnection):
self.support_addrv2 = support_addrv2
+ # If the peer supports wtxid-relay
+ self.wtxidrelay = wtxidrelay
+
def peer_connect(self, *args, services=NODE_NETWORK|NODE_WITNESS, send_version=True, **kwargs):
create_conn = super().peer_connect(*args, **kwargs)
@@ -394,7 +397,7 @@ class P2PInterface(P2PConnection):
def on_version(self, message):
assert message.nVersion >= MIN_VERSION_SUPPORTED, "Version {} received. Test framework only supports versions greater than {}".format(message.nVersion, MIN_VERSION_SUPPORTED)
- if message.nVersion >= 70016:
+ if message.nVersion >= 70016 and self.wtxidrelay:
self.send_message(msg_wtxidrelay())
self.send_message(msg_verack())
if self.support_addrv2: