mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-07-12 18:32:34 +02:00
test: Extends wait_for_getheaders so a specific block hash can be checked
Previously, `wait_for_getheaders` would check whether a node had received **any** getheaders message. This implied that, if a test needed to check for a specific block hash within a headers message, it had to make sure that it was checking the desired message. This normally involved having to manually clear `last_message`. This method, apart from being too verbose, was error prone, given an undesired `getheaders` would make tests pass. This adds the ability to check for a specific block_hash within the last `getheaders` message.
This commit is contained in:
@ -387,7 +387,7 @@ class CompactBlocksTest(BitcoinTestFramework):
|
||||
|
||||
if announce == "inv":
|
||||
test_node.send_message(msg_inv([CInv(MSG_BLOCK, block.sha256)]))
|
||||
test_node.wait_until(lambda: "getheaders" in test_node.last_message, timeout=30)
|
||||
test_node.wait_for_getheaders(timeout=30)
|
||||
test_node.send_header_for_blocks([block])
|
||||
else:
|
||||
test_node.send_header_for_blocks([block])
|
||||
|
Reference in New Issue
Block a user