merge bitcoin#29372: fix intermittent failure in rpc_setban.py --v2transport

This commit is contained in:
Kittywhiskers Van Gogh 2024-02-02 11:59:05 -05:00
parent e2788189fd
commit 5ee15faba0
No known key found for this signature in database
GPG Key ID: 30CD0C065E5C4AAD
2 changed files with 9 additions and 1 deletions

View File

@ -4,6 +4,7 @@
# file COPYING or http://www.opensource.org/licenses/mit-license.php. # file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test the setban rpc call.""" """Test the setban rpc call."""
from contextlib import ExitStack
from test_framework.test_framework import BitcoinTestFramework from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import ( from test_framework.util import (
p2p_port p2p_port
@ -28,7 +29,13 @@ class SetBanTests(BitcoinTestFramework):
self.nodes[1].setban("127.0.0.1", "add") self.nodes[1].setban("127.0.0.1", "add")
# Node 0 should not be able to reconnect # 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.restart_node(1, [])
self.nodes[0].addnode("127.0.0.1:" + str(p2p_port(1)), "onetry") self.nodes[0].addnode("127.0.0.1:" + str(p2p_port(1)), "onetry")

View File

@ -235,6 +235,7 @@ BASE_SCRIPTS = [
'p2p_filter.py', 'p2p_filter.py',
'p2p_blocksonly.py', 'p2p_blocksonly.py',
'rpc_setban.py', 'rpc_setban.py',
'rpc_setban.py --v2transport',
'mining_prioritisetransaction.py', 'mining_prioritisetransaction.py',
'p2p_invalid_locator.py', 'p2p_invalid_locator.py',
'p2p_invalid_block.py', 'p2p_invalid_block.py',