aboutsummaryrefslogtreecommitdiff
path: root/test/functional
diff options
context:
space:
mode:
authorAva Chow <github@achow101.com>2024-02-08 17:50:20 -0500
committerAva Chow <github@achow101.com>2024-02-08 17:57:03 -0500
commit5cdf31343b8a8a675627f62cac91c08a7216f71a (patch)
treef08aa725bdfb7215398690a26029e06756510a8f /test/functional
parent2bd0bf7cd963737aaab5815e81230f92151662d1 (diff)
parentcc87ee4c3934028e78a59de509951ff7226ec80d (diff)
downloadbitcoin-5cdf31343b8a8a675627f62cac91c08a7216f71a.tar.xz
Merge bitcoin/bitcoin#29372: test: fix intermittent failure in `rpc_setban.py --v2transport`, run it in CI
cc87ee4c3934028e78a59de509951ff7226ec80d test: fix intermittent failure in rpc_setban.py --v2transport (Martin Zumsande) Pull request description: This test failed for me on master locally: The reason is that when initiating a v2 connection and being immediately disconnected, a node cannot know if the disconnect happens because the peer only supports v1, or because it has banned you, so it schedules to reconnect with v1. If the test doesn't wait for that, the reconnect can happen at a bad time, resulting in failure in a later `connect_nodes` call. Also add the test with `--v2transport` to the test runner because banning with v2 seems like a useful thing to have test coverage for. ACKs for top commit: delta1: tested ACK cc87ee4c3934028e78a59de509951ff7226ec80d epiccurious: Concept ACK cc87ee4c3934028e78a59de509951ff7226ec80d. achow101: ACK cc87ee4c3934028e78a59de509951ff7226ec80d stratospher: tested ACK cc87ee4. nice find! Tree-SHA512: ae234d9b771d9c9c11501ddd93c99cf93257c999de3da62280d4d51806cd246b289c10a5f41fa7d5651b2fb4fdaee753f5b2d6939a99f89d71aa012af4a4d231
Diffstat (limited to 'test/functional')
-rwxr-xr-xtest/functional/rpc_setban.py9
-rwxr-xr-xtest/functional/test_runner.py1
2 files changed, 9 insertions, 1 deletions
diff --git a/test/functional/rpc_setban.py b/test/functional/rpc_setban.py
index b4f3d77e5b..bc426d7371 100755
--- a/test/functional/rpc_setban.py
+++ b/test/functional/rpc_setban.py
@@ -4,6 +4,7 @@
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test the setban rpc call."""
+from contextlib import ExitStack
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import (
p2p_port,
@@ -29,7 +30,13 @@ class SetBanTests(BitcoinTestFramework):
self.nodes[1].setban("127.0.0.1", "add")
# Node 0 should not be able to reconnect
- with self.nodes[1].assert_debug_log(expected_msgs=['dropped (banned)\n'], timeout=50):
+ context = ExitStack()
+ context.enter_context(self.nodes[1].assert_debug_log(expected_msgs=['dropped (banned)\n'], timeout=50))
+ # When disconnected right after connecting, a v2 node will attempt to reconnect with v1.
+ # Wait for that to happen so that it cannot mess with later tests.
+ if self.options.v2transport:
+ context.enter_context(self.nodes[0].assert_debug_log(expected_msgs=['trying v1 connection'], timeout=50))
+ with context:
self.restart_node(1, [])
self.nodes[0].addnode("127.0.0.1:" + str(p2p_port(1)), "onetry")
diff --git a/test/functional/test_runner.py b/test/functional/test_runner.py
index 9bfc9aa7d4..d037ccf6dd 100755
--- a/test/functional/test_runner.py
+++ b/test/functional/test_runner.py
@@ -254,6 +254,7 @@ BASE_SCRIPTS = [
'p2p_nobloomfilter_messages.py',
'p2p_filter.py',
'rpc_setban.py',
+ 'rpc_setban.py --v2transport',
'p2p_blocksonly.py',
'mining_prioritisetransaction.py',
'p2p_invalid_locator.py',