test framework: serialize/deserialize inv type as unsigned int

This commit is contained in:
Jon Atack 2020-08-27 15:10:15 +02:00
parent 407175e0c2
commit 7984c39be1
No known key found for this signature in database
GPG key ID: 4F5721B3D0E3921D

View file

@ -244,8 +244,8 @@ class CInv:
MSG_TX | MSG_WITNESS_FLAG: "WitnessTx", MSG_TX | MSG_WITNESS_FLAG: "WitnessTx",
MSG_BLOCK | MSG_WITNESS_FLAG: "WitnessBlock", MSG_BLOCK | MSG_WITNESS_FLAG: "WitnessBlock",
MSG_FILTERED_BLOCK: "filtered Block", MSG_FILTERED_BLOCK: "filtered Block",
4: "CompactBlock", MSG_CMPCT_BLOCK: "CompactBlock",
5: "WTX", MSG_WTX: "WTX",
} }
def __init__(self, t=0, h=0): def __init__(self, t=0, h=0):
@ -253,12 +253,12 @@ class CInv:
self.hash = h self.hash = h
def deserialize(self, f): def deserialize(self, f):
self.type = struct.unpack("<i", f.read(4))[0] self.type = struct.unpack("<I", f.read(4))[0]
self.hash = deser_uint256(f) self.hash = deser_uint256(f)
def serialize(self): def serialize(self):
r = b"" r = b""
r += struct.pack("<i", self.type) r += struct.pack("<I", self.type)
r += ser_uint256(self.hash) r += ser_uint256(self.hash)
return r return r