Skip to content

Commit 6395c8e

Browse files
committed
[test] Test the interactions between -forcednsseed and -dnsseed
Test that passing conflicting parameters for the two causes a startup error. This logic also impacts -connect, which soft sets -dnsseed, so add a test for that too.
1 parent 6f6b7df commit 6395c8e

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

test/functional/p2p_dns_seeds.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,24 @@ def init_arg_tests(self):
3232
with self.nodes[0].assert_debug_log(expected_msgs=["Loading addresses from DNS seed"], timeout=12):
3333
self.restart_node(0, [f"-connect={fakeaddr}", "-dnsseed=1"])
3434

35+
self.log.info("Check that running -forcednsseed and -dnsseed=0 throws an error.")
36+
self.nodes[0].stop_node()
37+
self.nodes[0].assert_start_raises_init_error(
38+
expected_msg="Error: Cannot set -forcednsseed to true when setting -dnsseed to false.",
39+
extra_args=["-forcednsseed=1", "-dnsseed=0"],
40+
)
41+
42+
self.log.info("Check that running -forcednsseed and -connect throws an error.")
43+
# -connect soft sets -dnsseed to false, so throws the same error
44+
self.nodes[0].stop_node()
45+
self.nodes[0].assert_start_raises_init_error(
46+
expected_msg="Error: Cannot set -forcednsseed to true when setting -dnsseed to false.",
47+
extra_args=["-forcednsseed=1", f"-connect={fakeaddr}"],
48+
)
49+
50+
# Restore default bitcoind settings
51+
self.restart_node(0)
52+
3553
def existing_outbound_connections_test(self):
3654
# Make sure addrman is populated to enter the conditional where we
3755
# delay and potentially skip DNS seeding.

0 commit comments

Comments
 (0)