Skip to content

Commit 6be398b

Browse files
fjahrjnewbery
authored andcommitted
test: Update test framework p2p protocol version to 70016
This new p2p protocol version allows to use WTXIDs for tx relay.
1 parent e364b2a commit 6be398b

File tree

2 files changed

+26
-2
lines changed

2 files changed

+26
-2
lines changed

test/functional/test_framework/messages.py

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
from test_framework.util import hex_str_to_bytes, assert_equal
3232

3333
MIN_VERSION_SUPPORTED = 60001
34-
MY_VERSION = 70014 # past bip-31 for ping/pong
34+
MY_VERSION = 70016 # past wtxid relay
3535
MY_SUBVERSION = b"/python-mininode-tester:0.0.3/"
3636
MY_RELAY = 1 # from version 70001 onwards, fRelay should be appended to version messages (BIP37)
3737

@@ -52,6 +52,7 @@
5252
MSG_TX = 1
5353
MSG_BLOCK = 2
5454
MSG_FILTERED_BLOCK = 3
55+
MSG_WTX = 5
5556
MSG_WITNESS_FLAG = 1 << 30
5657
MSG_TYPE_MASK = 0xffffffff >> 2
5758

@@ -231,7 +232,8 @@ class CInv:
231232
MSG_TX | MSG_WITNESS_FLAG: "WitnessTx",
232233
MSG_BLOCK | MSG_WITNESS_FLAG: "WitnessBlock",
233234
MSG_FILTERED_BLOCK: "filtered Block",
234-
4: "CompactBlock"
235+
4: "CompactBlock",
236+
5: "WTX",
235237
}
236238

237239
def __init__(self, t=0, h=0):
@@ -252,6 +254,9 @@ def __repr__(self):
252254
return "CInv(type=%s hash=%064x)" \
253255
% (self.typemap[self.type], self.hash)
254256

257+
def __eq__(self, other):
258+
return isinstance(other, CInv) and self.hash == other.hash and self.type == other.type
259+
255260

256261
class CBlockLocator:
257262
__slots__ = ("nVersion", "vHave")
@@ -1113,6 +1118,22 @@ def serialize(self):
11131118
def __repr__(self):
11141119
return "msg_tx(tx=%s)" % (repr(self.tx))
11151120

1121+
class msg_wtxidrelay:
1122+
__slots__ = ()
1123+
command = b"wtxidrelay"
1124+
1125+
def __init__(self):
1126+
pass
1127+
1128+
def deserialize(self, f):
1129+
pass
1130+
1131+
def serialize(self):
1132+
return b""
1133+
1134+
def __repr__(self):
1135+
return "msg_wtxidrelay()"
1136+
11161137

11171138
class msg_no_witness_tx(msg_tx):
11181139
__slots__ = ()

test/functional/test_framework/mininode.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
MSG_TYPE_MASK,
5353
msg_verack,
5454
msg_version,
55+
msg_wtxidrelay,
5556
NODE_NETWORK,
5657
NODE_WITNESS,
5758
sha256,
@@ -86,6 +87,7 @@
8687
b"tx": msg_tx,
8788
b"verack": msg_verack,
8889
b"version": msg_version,
90+
b"wtxidrelay": msg_wtxidrelay,
8991
}
9092

9193
MAGIC_BYTES = {
@@ -343,6 +345,7 @@ def on_reject(self, message): pass
343345
def on_sendcmpct(self, message): pass
344346
def on_sendheaders(self, message): pass
345347
def on_tx(self, message): pass
348+
def on_wtxidrelay(self, message): pass
346349

347350
def on_inv(self, message):
348351
want = msg_getdata()

0 commit comments

Comments
 (0)