Skip to content

Commit ab94a31

Browse files
committed
Merge #130: Serialize msg_header using CBlockHeader instead of CBlock
3a9a162 Serialize msg_header using CBlockHeader instead of CBlock (str4d) Pull request description: This resolves an issue I uncovered while updating `pynode` to work with `python-bitcoinlib` 0.7.0. The following usage was previously allowable, because `CBlock` was mutable: ```py db_block = self.chaindb.getblock(blkhash) block = copy.copy(db_block) block.vtx = [] msg.headers.append(block) ``` I [updated it](https://github.com/jgarzik/pynode/pull/19/files#diff-97b3827045a89ffba8170a14179aeb74L373) to the following, which resulted in the type error that this PR fixes: ```py block = self.chaindb.getblock(blkhash) msg.headers.append(block.get_header()) ``` Tree-SHA512: ef324cd0baf04cb20a0e4d06425542ee86238527500544a8d1fde15ed2f91c138b536b90123ce6b19e43649a57ebc129cba72230801f1e96ab1f487717df158e
2 parents 5f77336 + 3a9a162 commit ab94a31

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

bitcoin/messages.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -336,11 +336,11 @@ def __init__(self, protover=PROTO_VERSION):
336336
@classmethod
337337
def msg_deser(cls, f, protover=PROTO_VERSION):
338338
c = cls()
339-
c.headers = VectorSerializer.stream_deserialize(CBlock, f)
339+
c.headers = VectorSerializer.stream_deserialize(CBlockHeader, f)
340340
return c
341341

342342
def msg_ser(self, f):
343-
VectorSerializer.stream_serialize(CBlock, self.headers, f)
343+
VectorSerializer.stream_serialize(CBlockHeader, self.headers, f)
344344

345345
def __repr__(self):
346346
return "msg_headers(headers=%s)" % (repr(self.headers))

0 commit comments

Comments
 (0)