MCPcopy Index your code
hub / github.com/petertodd/python-bitcoinlib / CInv

Class CInv

bitcoin/net.py:73–97  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

71
72
73class CInv(Serializable):
74 typemap = {
75 0: "Error",
76 1: "TX",
77 2: "Block",
78 3: "FilteredBlock",
79 4: "CompactBlock"}
80
81 def __init__(self):
82 self.type = 0
83 self.hash = 0
84
85 @classmethod
86 def stream_deserialize(cls, f):
87 c = cls()
88 c.type = struct.unpack(b"<i", ser_read(f, 4))[0]
89 c.hash = ser_read(f, 32)
90 return c
91
92 def stream_serialize(self, f):
93 f.write(struct.pack(b"<i", self.type))
94 f.write(self.hash)
95
96 def __repr__(self):
97 return "CInv(type=%s hash=%s)" % (self.typemap[self.type], b2lx(self.hash))
98
99
100class CBlockLocator(Serializable):

Callers 1

test_serializationMethod · 0.90

Calls

no outgoing calls

Tested by 1

test_serializationMethod · 0.72