aboutsummaryrefslogtreecommitdiff
path: root/test/functional
diff options
context:
space:
mode:
authorJohn Newbery <john@johnnewbery.com>2020-07-10 16:48:20 +0100
committerJohn Newbery <john@johnnewbery.com>2020-07-10 22:14:18 +0100
commit37a934e6b35bea2125732d2c074998d9fe70633e (patch)
tree6e2b3c030b01fddfbfbc8db8e94c2d1a805953aa /test/functional
parentc0b0b0240f986b88a31336db2e6906de0edc0816 (diff)
[protocol] Remove unused CADDR_TIME_VERSION
Add comments to CAddress serialization code explaining why it's no longer needed.
Diffstat (limited to 'test/functional')
-rwxr-xr-xtest/functional/test_framework/messages.py14
1 files changed, 8 insertions, 6 deletions
diff --git a/test/functional/test_framework/messages.py b/test/functional/test_framework/messages.py
index eb1244035f..12302cdbc3 100755
--- a/test/functional/test_framework/messages.py
+++ b/test/functional/test_framework/messages.py
@@ -207,17 +207,19 @@ class CAddress:
self.ip = "0.0.0.0"
self.port = 0
- def deserialize(self, f, with_time=True):
+ def deserialize(self, f, *, with_time=True):
if with_time:
+ # VERSION messages serialize CAddress objects without time
self.time = struct.unpack("<i", f.read(4))[0]
self.nServices = struct.unpack("<Q", f.read(8))[0]
self.pchReserved = f.read(12)
self.ip = socket.inet_ntoa(f.read(4))
self.port = struct.unpack(">H", f.read(2))[0]
- def serialize(self, with_time=True):
+ def serialize(self, *, with_time=True):
r = b""
if with_time:
+ # VERSION messages serialize CAddress objects without time
r += struct.pack("<i", self.time)
r += struct.pack("<Q", self.nServices)
r += self.pchReserved
@@ -973,10 +975,10 @@ class msg_version:
self.nServices = struct.unpack("<Q", f.read(8))[0]
self.nTime = struct.unpack("<q", f.read(8))[0]
self.addrTo = CAddress()
- self.addrTo.deserialize(f, False)
+ self.addrTo.deserialize(f, with_time=False)
self.addrFrom = CAddress()
- self.addrFrom.deserialize(f, False)
+ self.addrFrom.deserialize(f, with_time=False)
self.nNonce = struct.unpack("<Q", f.read(8))[0]
self.strSubVer = deser_string(f)
@@ -996,8 +998,8 @@ class msg_version:
r += struct.pack("<i", self.nVersion)
r += struct.pack("<Q", self.nServices)
r += struct.pack("<q", self.nTime)
- r += self.addrTo.serialize(False)
- r += self.addrFrom.serialize(False)
+ r += self.addrTo.serialize(with_time=False)
+ r += self.addrFrom.serialize(with_time=False)
r += struct.pack("<Q", self.nNonce)
r += ser_string(self.strSubVer)
r += struct.pack("<i", self.nStartingHeight)