aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorglozow <gloriajzhao@gmail.com>2024-04-17 11:24:24 +0100
committerglozow <gloriajzhao@gmail.com>2024-04-17 11:28:42 +0100
commit8cd9475321737a69454f3b54a588b7bfe9f32847 (patch)
treea3f4dc39a83e32fc36564ade2ee490b6272b4f49
parentc8e3b947444cf4aa008002888e3ef4c4e3a11da4 (diff)
parent1ae5b208d339fa984d9caf4fab89b0b2ba9cc197 (diff)
downloadbitcoin-8cd9475321737a69454f3b54a588b7bfe9f32847.tar.xz
Merge bitcoin/bitcoin#29893: test: fix intermittent failure in p2p_compactblocks_hb.py
1ae5b208d339fa984d9caf4fab89b0b2ba9cc197 test: fix intermittent failure in p2p_compactblocks_hb.py (Martin Zumsande) Pull request description: Fixes #29860 As a result of node1 receiving a block, it sends out SENDCMPCT messages to some of its peers to update the high-bandwidth status. We need to wait until those are received and processed by the peers to avoid intermittent failures. Before, we'd only wait until all peers have synced with the new block (within `generate`) which is not sufficient. I could reproduce the failure by adding a `std::this_thread::sleep_for(std::chrono::milliseconds(1000));` sleep to the [net_processing code](https://github.com/bitcoin/bitcoin/blob/c7567d9223a927a88173ff04eeb4f54a5c02b43d/src/net_processing.cpp#L3763) that processes `NetMsgType::SENDCMPCT`. ACKs for top commit: instagibbs: ACK 1ae5b208d339fa984d9caf4fab89b0b2ba9cc197 alfonsoromanz: Tested ACK 1ae5b208d339fa984d9caf4fab89b0b2ba9cc197 glozow: ACK 1ae5b208d339fa984d9caf4fab89b0b2ba9cc197 Tree-SHA512: 47c29616e73a5e0ff966fc231e4f672c1a6892511e5c10a3905b30ad6b2a3d1267fa0a88bd8f64b523fe580199d22a43545c84e361879e5096483152065c4b9a
-rwxr-xr-xtest/functional/p2p_compactblocks_hb.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/test/functional/p2p_compactblocks_hb.py b/test/functional/p2p_compactblocks_hb.py
index c985a1f98d..023b33ff6d 100755
--- a/test/functional/p2p_compactblocks_hb.py
+++ b/test/functional/p2p_compactblocks_hb.py
@@ -32,10 +32,15 @@ class CompactBlocksConnectionTest(BitcoinTestFramework):
self.connect_nodes(peer, 0)
self.generate(self.nodes[0], 1)
self.disconnect_nodes(peer, 0)
- status_to = [self.peer_info(1, i)['bip152_hb_to'] for i in range(2, 6)]
- status_from = [self.peer_info(i, 1)['bip152_hb_from'] for i in range(2, 6)]
- assert_equal(status_to, status_from)
- return status_to
+
+ def status_to():
+ return [self.peer_info(1, i)['bip152_hb_to'] for i in range(2, 6)]
+
+ def status_from():
+ return [self.peer_info(i, 1)['bip152_hb_from'] for i in range(2, 6)]
+
+ self.wait_until(lambda: status_to() == status_from())
+ return status_to()
def run_test(self):
self.log.info("Testing reserved high-bandwidth mode slot for outbound peer...")