mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-05-31 00:05:13 +02:00
test: complete impl. of msg_merkleblock and wait_for_merkleblock
Implements the missing initialization/serialization methods for msg_merkleblock, based on the already present class CMerkleBlock. Also changes the method wait_for_merkleblock() to be more precise by waiting for a merkleblock with a specified blockhash instead of an arbitrary one. In the BIP37 test p2p_filter.py, this new method is used to make the test of receiving merkleblock and tx if a filter is set to be more precise, by checking if they also arrive in the right order.
This commit is contained in:
@@ -1321,10 +1321,23 @@ class msg_headers:
|
||||
|
||||
|
||||
class msg_merkleblock:
|
||||
__slots__ = ("merkleblock",)
|
||||
command = b"merkleblock"
|
||||
|
||||
def __init__(self, merkleblock=None):
|
||||
if merkleblock is None:
|
||||
self.merkleblock = CMerkleBlock()
|
||||
else:
|
||||
self.merkleblock = merkleblock
|
||||
|
||||
def deserialize(self, f):
|
||||
pass # Placeholder for now
|
||||
self.merkleblock.deserialize(f)
|
||||
|
||||
def serialize(self):
|
||||
return self.merkleblock.serialize()
|
||||
|
||||
def __repr__(self):
|
||||
return "msg_merkleblock(merkleblock=%s)" % (repr(self.merkleblock))
|
||||
|
||||
|
||||
class msg_filterload:
|
||||
|
||||
Reference in New Issue
Block a user