| 1278 | # headers message has |
| 1279 | # <count> <vector of block headers> |
| 1280 | class msg_headers(): |
| 1281 | command = b"headers" |
| 1282 | |
| 1283 | def __init__(self, headers=None): |
| 1284 | self.headers = headers if headers is not None else [] |
| 1285 | |
| 1286 | def deserialize(self, f): |
| 1287 | # comment in bitcoind indicates these should be deserialized as blocks |
| 1288 | blocks = deser_vector(f, CBlock, legacy=False) |
| 1289 | for x in blocks: |
| 1290 | self.headers.append(CBlockHeader(x)) |
| 1291 | |
| 1292 | def serialize(self): |
| 1293 | blocks = [CBlock(x) for x in self.headers] |
| 1294 | return ser_vector(blocks, legacy=False) |
| 1295 | |
| 1296 | def __repr__(self): |
| 1297 | return "msg_headers(headers=%s)" % repr(self.headers) |
| 1298 | |
| 1299 | |
| 1300 | class msg_reject(): |
no outgoing calls