Skip to content

Commit fafc0d6

Browse files
author
MarcoFalke
committed
test: Use int from_bytes and to_bytes over struct packing
This is done in prepration for the scripted diff, which can not deal with the 0 literal int.
1 parent fa3886b commit fafc0d6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

test/functional/test_framework/messages.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -399,12 +399,12 @@ def __init__(self):
399399
self.vHave = []
400400

401401
def deserialize(self, f):
402-
struct.unpack("<i", f.read(4))[0] # Ignore version field.
402+
int.from_bytes(f.read(4), "little", signed=True) # Ignore version field.
403403
self.vHave = deser_uint256_vector(f)
404404

405405
def serialize(self):
406406
r = b""
407-
r += struct.pack("<i", 0) # Bitcoin Core ignores version field. Set it to 0.
407+
r += (0).to_bytes(4, "little", signed=True) # Bitcoin Core ignores the version field. Set it to 0.
408408
r += ser_uint256_vector(self.vHave)
409409
return r
410410

0 commit comments

Comments
 (0)