From dd8447f70faf6419b4617da3c1b57098e9cd66a6 Mon Sep 17 00:00:00 2001 From: Sebastian Falbesoner Date: Fri, 13 Jun 2025 01:24:50 +0200 Subject: [PATCH] test: fix catchup loop in outbound eviction functional test The catchup loop in the outbound eviction functional test currently has a small flaw, as the contained waiting for a `getheaders` message just waits for any such message instead of one with the intended block hash. The reason is that the `prev_prev_hash` variable is set incorrectly, since the `tip_header` instance is not updated and its field `.hash` is None. Fix that by updating `tip_header` and use the correct field -- we want the tip header's previous hash (`.hashPrevBlock`). --- test/functional/p2p_outbound_eviction.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/functional/p2p_outbound_eviction.py b/test/functional/p2p_outbound_eviction.py index 30ac85e32f3..3d6f154a34a 100755 --- a/test/functional/p2p_outbound_eviction.py +++ b/test/functional/p2p_outbound_eviction.py @@ -88,6 +88,7 @@ class P2POutEvict(BitcoinTestFramework): # Generate an additional block so the peers is 2 blocks behind prev_header = from_hex(CBlockHeader(), node.getblockheader(best_block_hash, False)) best_block_hash = self.generateblock(node, output="raw(42)", transactions=[])["hash"] + tip_header = from_hex(CBlockHeader(), node.getblockheader(best_block_hash, False)) peer.sync_with_ping() # Advance time but not enough to evict the peer @@ -100,7 +101,7 @@ class P2POutEvict(BitcoinTestFramework): # Send a header with the previous tip (so we go back to 1 block behind) peer.send_and_ping(msg_headers([prev_header])) - prev_prev_hash = tip_header.hash + prev_prev_hash = tip_header.hashPrevBlock self.log.info("Create an outbound connection and take some time to catch up, but do it in time") # Check that if the peer manages to catch up within time, the timeouts are removed (and the peer is not disconnected)