mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 06:58:57 +01: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:
@@ -397,14 +397,13 @@ class P2PInterface(P2PConnection):
|
||||
|
||||
wait_until(test_function, timeout=timeout, lock=mininode_lock)
|
||||
|
||||
def wait_for_merkleblock(self, timeout=60):
|
||||
def wait_for_merkleblock(self, blockhash, timeout=60):
|
||||
def test_function():
|
||||
assert self.is_connected
|
||||
last_filtered_block = self.last_message.get('merkleblock')
|
||||
if not last_filtered_block:
|
||||
return False
|
||||
# TODO change this method to take a hash value and only return true if the correct block has been received
|
||||
return True
|
||||
return last_filtered_block.merkleblock.header.rehash() == blockhash
|
||||
|
||||
wait_until(test_function, timeout=timeout, lock=mininode_lock)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user