test: dont connect nodes in feature_bind_port_discover
What changed, and why it matters
This commit changes only a Bitcoin Core functional test file. It stops the test framework from automatically connecting test nodes to each other and marks each test node as having an explicit network bind. The change is purely about making an existing test more accurate and reliable; it does not touch production code or introduce any security issue.
No security action needed. This is a routine test-maintenance change.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch overrides setup_network() and setup_nodes() in test/functional/feature_bind_port_discover.py. setup_network() now only calls setup_nodes(), preventing the framework from adding P2P connections between nodes. setup_nodes() creates nodes, sets node.has_explicit_bind=True for every node, then starts them. This avoids the framework auto-injecting -bind= arguments and keeps each node isolated on its configured address/interface. The change is test-only and has no effect on Bitcoin Core’s runtime behavior.
Changed components
test/functional/feature_bind_port_discover.pyInspect captured patch +18 / −0
diff --git a/test/functional/feature_bind_port_discover.py b/test/functional/feature_bind_port_discover.py
index 338dbd02..f3fe3454 100755
--- a/test/functional/feature_bind_port_discover.py
+++ b/test/functional/feature_bind_port_discover.py
@@ -38,6 +38,24 @@ class BindPortDiscoverTest(BitcoinTestFramework):
]
self.num_nodes = len(self.extra_args)
+ def setup_network(self):
+ """
+ Override to avoid connecting nodes together. This test intentionally does not connect nodes
+ because each node is bound to a different address or interface, and connections are not needed.
+ """
+ self.setup_nodes()
+
+ def setup_nodes(self):
+ """
+ Override to set has_explicit_bind=True for nodes with explicit bind arguments.
+ """
+ self.add_nodes(self.num_nodes, self.extra_args)
+ # TestNode.start() will add -bind= to extra_args if has_explicit_bind is
+ # False. We do not want any -bind= thus set has_explicit_bind to True.
+ for node in self.nodes:
+ node.has_explicit_bind = True
+ self.start_nodes()
+
def add_options(self, parser):
parser.add_argument(
"--ihave1111and2222", action='store_true', dest="ihave1111and2222",
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.