diff options
author | MarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz> | 2023-12-12 18:39:37 +0100 |
---|---|---|
committer | MarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz> | 2024-01-29 11:12:15 +0100 |
commit | 55556a64a8e4e6238f990cf66295c3b9594c2c3d (patch) | |
tree | 22a019f53207737b7f8ce1590b14dbd3154137a6 /test/functional/test_framework | |
parent | fa3fa86ddaaa2246e873b7a3f19bc589a3f46c11 (diff) | |
download | bitcoin-55556a64a8e4e6238f990cf66295c3b9594c2c3d.tar.xz |
test: Remove struct import from messages.py
Diffstat (limited to 'test/functional/test_framework')
-rwxr-xr-x | test/functional/test_framework/messages.py | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/test/functional/test_framework/messages.py b/test/functional/test_framework/messages.py index 4b8bf7035c..c8a8286e01 100755 --- a/test/functional/test_framework/messages.py +++ b/test/functional/test_framework/messages.py @@ -25,7 +25,6 @@ from io import BytesIO import math import random import socket -import struct import time import unittest @@ -92,11 +91,11 @@ def ser_compact_size(l): if l < 253: r = l.to_bytes(1, "little") elif l < 0x10000: - r = struct.pack("<BH", 253, l) + r = (253).to_bytes(1, "little") + l.to_bytes(2, "little") elif l < 0x100000000: - r = struct.pack("<BI", 254, l) + r = (254).to_bytes(1, "little") + l.to_bytes(4, "little") else: - r = struct.pack("<BQ", 255, l) + r = (255).to_bytes(1, "little") + l.to_bytes(8, "little") return r @@ -1635,12 +1634,12 @@ class msg_sendcmpct: self.version = version def deserialize(self, f): - self.announce = struct.unpack("<?", f.read(1))[0] + self.announce = bool(int.from_bytes(f.read(1), "little")) self.version = int.from_bytes(f.read(8), "little") def serialize(self): r = b"" - r += struct.pack("<?", self.announce) + r += int(self.announce).to_bytes(1, "little") r += self.version.to_bytes(8, "little") return r |