MCPcopy Create free account
hub / github.com/ElementsProject/elements / CInv

Class CInv

test/functional/test_framework/messages.py:310–343  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

308
309
310class CInv:
311 __slots__ = ("hash", "type")
312
313 typemap = {
314 0: "Error",
315 MSG_TX: "TX",
316 MSG_BLOCK: "Block",
317 MSG_TX | MSG_WITNESS_FLAG: "WitnessTx",
318 MSG_BLOCK | MSG_WITNESS_FLAG: "WitnessBlock",
319 MSG_FILTERED_BLOCK: "filtered Block",
320 MSG_CMPCT_BLOCK: "CompactBlock",
321 MSG_WTX: "WTX",
322 }
323
324 def __init__(self, t=0, h=0):
325 self.type = t
326 self.hash = h
327
328 def deserialize(self, f):
329 self.type = struct.unpack("<I", f.read(4))[0]
330 self.hash = deser_uint256(f)
331
332 def serialize(self):
333 r = b""
334 r += struct.pack("<I", self.type)
335 r += ser_uint256(self.hash)
336 return r
337
338 def __repr__(self):
339 return "CInv(type=%s hash=%064x)" \
340 % (self.typemap[self.type], self.hash)
341
342 def __eq__(self, other):
343 return isinstance(other, CInv) and self.hash == other.hash and self.type == other.type
344
345
346class CBlockLocator:

Callers 15

send_get_dataMethod · 0.90
send_block_invMethod · 0.90
run_testMethod · 0.90
run_testMethod · 0.90
run_testMethod · 0.90
run_testMethod · 0.90
blocksonly_mode_testsMethod · 0.90
run_testMethod · 0.90
run_testMethod · 0.90

Calls

no outgoing calls

Tested by 15

run_testMethod · 0.72
test_tx_requestsMethod · 0.72
test_inv_blockMethod · 0.72
test_in_flight_maxMethod · 0.72
test_expiry_fallbackMethod · 0.72
test_preferred_invMethod · 0.72
test_txid_inv_delayMethod · 0.72
test_large_inv_batchMethod · 0.72