0
0
Fork 0
mirror of https://github.com/bitcoin/bitcoin.git synced 2025-02-08 10:31:50 -05:00

[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.
This commit is contained in:
Amiti Uttarwar 2021-05-28 13:38:46 -07:00
parent 6f6b7df6bd
commit 6395c8ed56

View file

@ -32,6 +32,24 @@ class P2PDNSSeeds(BitcoinTestFramework):
with self.nodes[0].assert_debug_log(expected_msgs=["Loading addresses from DNS seed"], timeout=12):
self.restart_node(0, [f"-connect={fakeaddr}", "-dnsseed=1"])
self.log.info("Check that running -forcednsseed and -dnsseed=0 throws an error.")
self.nodes[0].stop_node()
self.nodes[0].assert_start_raises_init_error(
expected_msg="Error: Cannot set -forcednsseed to true when setting -dnsseed to false.",
extra_args=["-forcednsseed=1", "-dnsseed=0"],
)
self.log.info("Check that running -forcednsseed and -connect throws an error.")
# -connect soft sets -dnsseed to false, so throws the same error
self.nodes[0].stop_node()
self.nodes[0].assert_start_raises_init_error(
expected_msg="Error: Cannot set -forcednsseed to true when setting -dnsseed to false.",
extra_args=["-forcednsseed=1", f"-connect={fakeaddr}"],
)
# Restore default bitcoind settings
self.restart_node(0)
def existing_outbound_connections_test(self):
# Make sure addrman is populated to enter the conditional where we
# delay and potentially skip DNS seeding.