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.
This commit is contained in:
MarcoFalke 2023-12-12 19:44:18 +01:00
parent fa3886b7c6
commit fafc0d68ee
No known key found for this signature in database

View file

@ -399,12 +399,12 @@ class CBlockLocator:
self.vHave = []
def deserialize(self, f):
struct.unpack("<i", f.read(4))[0] # Ignore version field.
int.from_bytes(f.read(4), "little", signed=True) # Ignore version field.
self.vHave = deser_uint256_vector(f)
def serialize(self):
r = b""
r += struct.pack("<i", 0) # Bitcoin Core ignores version field. Set it to 0.
r += (0).to_bytes(4, "little", signed=True) # Bitcoin Core ignores the version field. Set it to 0.
r += ser_uint256_vector(self.vHave)
return r