test: Remove unused, confusing and brittle connect_nodes.wait_for_connect
What changed, and why it matters
This commit removes an unused optional flag from a test helper function in Bitcoin Core's internal testing framework. It only affects test code, not the live Bitcoin network or wallet software, and has no security relevance.
No security action needed. This is a routine test-framework cleanup.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The change deletes the wait_for_connect keyword argument from connect_nodes() in test/functional/test_framework/test_framework.py. The argument was already unused in the codebase and its removal simplifies the helper. The default behavior—waiting for the connection to be verified—remains the only behavior. No runtime, consensus, or networking code is modified.
Changed components
test/functional/test_framework/test_framework.pyInspect captured patch +1 / −11
diff --git a/test/functional/test_framework/test_framework.py b/test/functional/test_framework/test_framework.py
index 229ff893..256a384f 100755
--- a/test/functional/test_framework/test_framework.py
+++ b/test/functional/test_framework/test_framework.py
@@ -549,14 +549,7 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass):
def wait_for_node_exit(self, i, timeout):
self.nodes[i].process.wait(timeout)
- def connect_nodes(self, a, b, *, peer_advertises_v2=None, wait_for_connect: bool = True):
- """
- Kwargs:
- wait_for_connect: if True, block until the nodes are verified as connected. You might
- want to disable this when using -stopatheight with one of the connected nodes,
- since there will be a race between the actual connection and performing
- the assertions before one node shuts down.
- """
+ def connect_nodes(self, a, b, *, peer_advertises_v2=None):
from_connection = self.nodes[a]
to_connection = self.nodes[b]
@@ -582,9 +575,6 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass):
# compatibility with older clients
from_connection.addnode(ip_port, "onetry")
- if not wait_for_connect:
- return
-
self.wait_until(lambda: find_conn(from_connection, to_connection_subver, inbound=False) is not None)
self.wait_until(lambda: find_conn(to_connection, from_connection_subver, inbound=True) is not None)
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.