Skip to content

Commit 1ae5b20

Browse files
committed
test: fix intermittent failure in p2p_compactblocks_hb.py
As a result of node1 receiving a block, it sends out SENDCMPCT messages to its peers to update the status. We need to wait until those are received and processed by the peers to avoid intermittent failures.
1 parent c7567d9 commit 1ae5b20

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

test/functional/p2p_compactblocks_hb.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,15 @@ def relay_block_through(self, peer):
3232
self.connect_nodes(peer, 0)
3333
self.generate(self.nodes[0], 1)
3434
self.disconnect_nodes(peer, 0)
35-
status_to = [self.peer_info(1, i)['bip152_hb_to'] for i in range(2, 6)]
36-
status_from = [self.peer_info(i, 1)['bip152_hb_from'] for i in range(2, 6)]
37-
assert_equal(status_to, status_from)
38-
return status_to
35+
36+
def status_to():
37+
return [self.peer_info(1, i)['bip152_hb_to'] for i in range(2, 6)]
38+
39+
def status_from():
40+
return [self.peer_info(i, 1)['bip152_hb_from'] for i in range(2, 6)]
41+
42+
self.wait_until(lambda: status_to() == status_from())
43+
return status_to()
3944

4045
def run_test(self):
4146
self.log.info("Testing reserved high-bandwidth mode slot for outbound peer...")

0 commit comments

Comments
 (0)