| 71 | |
| 72 | |
| 73 | class 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 | |
| 100 | class CBlockLocator(Serializable): |
no outgoing calls