Changeset View
Changeset View
Standalone View
Standalone View
test/functional/test_framework/messages.py
Show First 20 Lines • Show All 54 Lines • ▼ Show 20 Lines | |||||
# NODE_XTHIN = (1 << 4) # removed in v0.22.12 | # NODE_XTHIN = (1 << 4) # removed in v0.22.12 | ||||
NODE_COMPACT_FILTERS = (1 << 6) | NODE_COMPACT_FILTERS = (1 << 6) | ||||
NODE_NETWORK_LIMITED = (1 << 10) | NODE_NETWORK_LIMITED = (1 << 10) | ||||
NODE_AVALANCHE = (1 << 24) | NODE_AVALANCHE = (1 << 24) | ||||
MSG_TX = 1 | MSG_TX = 1 | ||||
MSG_BLOCK = 2 | MSG_BLOCK = 2 | ||||
MSG_FILTERED_BLOCK = 3 | MSG_FILTERED_BLOCK = 3 | ||||
MSG_CMPCTBLOCK = 4 | MSG_CMPCT_BLOCK = 4 | ||||
MSG_TYPE_MASK = 0xffffffff >> 2 | MSG_TYPE_MASK = 0xffffffff >> 2 | ||||
FILTER_TYPE_BASIC = 0 | FILTER_TYPE_BASIC = 0 | ||||
# Serialization/deserialization tools | # Serialization/deserialization tools | ||||
def sha256(s): | def sha256(s): | ||||
▲ Show 20 Lines • Show All 173 Lines • ▼ Show 20 Lines | |||||
class CInv: | class CInv: | ||||
__slots__ = ("hash", "type") | __slots__ = ("hash", "type") | ||||
typemap = { | typemap = { | ||||
0: "Error", | 0: "Error", | ||||
MSG_TX: "TX", | MSG_TX: "TX", | ||||
MSG_BLOCK: "Block", | MSG_BLOCK: "Block", | ||||
MSG_FILTERED_BLOCK: "filtered Block", | MSG_FILTERED_BLOCK: "filtered Block", | ||||
MSG_CMPCTBLOCK: "CompactBlock" | MSG_CMPCT_BLOCK: "CompactBlock" | ||||
} | } | ||||
def __init__(self, t=0, h=0): | def __init__(self, t=0, h=0): | ||||
self.type = t | self.type = t | ||||
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] | ||||
▲ Show 20 Lines • Show All 1,529 Lines • Show Last 20 Lines |