aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMacroFake <falke.marco@gmail.com>2022-05-18 15:39:18 +0200
committerMacroFake <falke.marco@gmail.com>2022-05-18 15:39:20 +0200
commit139f789d7a9fbb64176d3897239f93f60019c521 (patch)
tree00fad0fa188cdf76c703ce3ea98baeabbafce4b2 /test
parent84bf31f8e9842cb5f613151dc4c5a0ffa67a3a03 (diff)
parentfaac67cab02a755b0ce67716c5e5889432b13b83 (diff)
downloadbitcoin-139f789d7a9fbb64176d3897239f93f60019c521.tar.xz
Merge bitcoin/bitcoin#25124: test: Fix intermittent race in p2p_unrequested_blocks.py
faac67cab02a755b0ce67716c5e5889432b13b83 test: Fix intermittent race in p2p_unrequested_blocks.py (MacroFake) Pull request description: Disconnect may also result in an `OSError`, not only an `AssertionError`. Instead of maintaining a dead code path and enumerating disconnect reasons, just assume disconnection happens every time. ACKs for top commit: jamesob: Code review ACK https://github.com/bitcoin/bitcoin/pull/25124/commits/faac67cab02a755b0ce67716c5e5889432b13b83 Tree-SHA512: d2cec003168e421a5faed275cb2e1ef9fc63f9e8514f41d21da17e8964c79e5b453ccd72cd7ec62805f45293cf877be5bc8124ae98a515c0aa42d6e053409653
Diffstat (limited to 'test')
-rwxr-xr-xtest/functional/p2p_unrequested_blocks.py15
1 files changed, 5 insertions, 10 deletions
diff --git a/test/functional/p2p_unrequested_blocks.py b/test/functional/p2p_unrequested_blocks.py
index 9c4e1dd1b1..76d9b045ce 100755
--- a/test/functional/p2p_unrequested_blocks.py
+++ b/test/functional/p2p_unrequested_blocks.py
@@ -257,16 +257,11 @@ class AcceptBlockTest(BitcoinTestFramework):
test_node.send_message(msg_block(block_291))
# At this point we've sent an obviously-bogus block, wait for full processing
- # without assuming whether we will be disconnected or not
- try:
- # Only wait a short while so the test doesn't take forever if we do get
- # disconnected
- test_node.sync_with_ping(timeout=1)
- except AssertionError:
- test_node.wait_for_disconnect()
-
- self.nodes[0].disconnect_p2ps()
- test_node = self.nodes[0].add_p2p_connection(P2PInterface())
+ # and assume disconnection
+ test_node.wait_for_disconnect()
+
+ self.nodes[0].disconnect_p2ps()
+ test_node = self.nodes[0].add_p2p_connection(P2PInterface())
# We should have failed reorg and switched back to 290 (but have block 291)
assert_equal(self.nodes[0].getblockcount(), 290)