diff options
author | Sergi Delgado Segura <sergi.delgado.s@gmail.com> | 2024-03-26 16:03:41 +0100 |
---|---|---|
committer | Sergi Delgado Segura <sergi.delgado.s@gmail.com> | 2024-04-04 13:36:45 +0200 |
commit | c4f857cc301d856f3c60acbe6271d3fe19441c7a (patch) | |
tree | a7842539dd78a8ce5d5e927c9b212f9a741c4da8 /test/functional/p2p_segwit.py | |
parent | 71c51c161d476cc495afdb7864283fdb84d2dc0c (diff) | |
download | bitcoin-c4f857cc301d856f3c60acbe6271d3fe19441c7a.tar.xz |
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.
Diffstat (limited to 'test/functional/p2p_segwit.py')
-rwxr-xr-x | test/functional/p2p_segwit.py | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/test/functional/p2p_segwit.py b/test/functional/p2p_segwit.py index af47c6d9f0..213c748eda 100755 --- a/test/functional/p2p_segwit.py +++ b/test/functional/p2p_segwit.py @@ -191,14 +191,13 @@ class TestP2PConn(P2PInterface): def announce_block_and_wait_for_getdata(self, block, use_header, timeout=60): with p2p_lock: self.last_message.pop("getdata", None) - self.last_message.pop("getheaders", None) msg = msg_headers() msg.headers = [CBlockHeader(block)] if use_header: self.send_message(msg) else: self.send_message(msg_inv(inv=[CInv(MSG_BLOCK, block.sha256)])) - self.wait_for_getheaders(timeout=timeout) + self.wait_for_getheaders(block_hash=block.hashPrevBlock, timeout=timeout) self.send_message(msg) self.wait_for_getdata([block.sha256], timeout=timeout) |