Skip to content

Commit

Permalink
Add functional test support for sendrecon message
Browse files Browse the repository at this point in the history
This is needed to pass existing functional tests.
  • Loading branch information
naumenkogs authored and rebroad committed Dec 12, 2021
1 parent efedda3 commit 372927e
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
28 changes: 28 additions & 0 deletions test/functional/test_framework/messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -1816,3 +1816,31 @@ def serialize(self):
def __repr__(self):
return "msg_cfcheckpt(filter_type={:#x}, stop_hash={:x})".format(
self.filter_type, self.stop_hash)

class msg_sendrecon:
__slots__ = ("initiator", "responder", "version", "salt")
msgtype = b"sendrecon"

def __init__(self):
self.initiator = False
self.responder = False
self.version = 0
self.salt = 0

def deserialize(self, f):
self.initiator = struct.unpack("<?", f.read(1))[0]
self.responder = struct.unpack("<?", f.read(1))[0]
self.version = struct.unpack("<I", f.read(4))[0]
self.salt = struct.unpack("<Q", f.read(8))[0]

def serialize(self):
r = b""
r += struct.pack("<?", self.initiator)
r += struct.pack("<?", self.responder)
r += struct.pack("<I", self.version)
r += struct.pack("<Q", self.salt)
return r

def __repr__(self):
return "msg_sendrecon(initiator=%i, responder=%i, version=%lu, salt=%lu)" %\
(self.initiator, self.responder, self.version, self.salt)
3 changes: 3 additions & 0 deletions test/functional/test_framework/p2p.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
msg_sendaddrv2,
msg_sendcmpct,
msg_sendheaders,
msg_sendrecon,
msg_tx,
MSG_TX,
MSG_TYPE_MASK,
Expand Down Expand Up @@ -120,6 +121,7 @@
b"sendaddrv2": msg_sendaddrv2,
b"sendcmpct": msg_sendcmpct,
b"sendheaders": msg_sendheaders,
b"sendrecon": msg_sendrecon,
b"tx": msg_tx,
b"verack": msg_verack,
b"version": msg_version,
Expand Down Expand Up @@ -415,6 +417,7 @@ def on_pong(self, message): pass
def on_sendaddrv2(self, message): pass
def on_sendcmpct(self, message): pass
def on_sendheaders(self, message): pass
def on_sendrecon(self, message): pass
def on_tx(self, message): pass
def on_wtxidrelay(self, message): pass

Expand Down

0 comments on commit 372927e

Please sign in to comment.