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

Class CInv

test/bitcoin_functional/functional/test_framework/messages.py:222–250  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

220
221
222class CInv:
223 __slots__ = ("hash", "type")
224
225 typemap = {
226 0: "Error",
227 1: "TX",
228 2: "Block",
229 1|MSG_WITNESS_FLAG: "WitnessTx",
230 2|MSG_WITNESS_FLAG : "WitnessBlock",
231 4: "CompactBlock"
232 }
233
234 def __init__(self, t=0, h=0):
235 self.type = t
236 self.hash = h
237
238 def deserialize(self, f):
239 self.type = struct.unpack("<i", f.read(4))[0]
240 self.hash = deser_uint256(f)
241
242 def serialize(self):
243 r = b""
244 r += struct.pack("<i", self.type)
245 r += ser_uint256(self.hash)
246 return r
247
248 def __repr__(self):
249 return "CInv(type=%s hash=%064x)" \
250 % (self.typemap[self.type], self.hash)
251
252
253class 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
send_block_requestMethod · 0.90

Calls

no outgoing calls