[test] Test the interactions between -connect and -dnsseed

This commit is contained in:
Amiti Uttarwar 2021-05-24 15:56:32 -07:00
parent 75c05af361
commit 35851450a9

View File

@ -15,9 +15,22 @@ class P2PDNSSeeds(BitcoinTestFramework):
self.extra_args = [["-dnsseed=1"]] self.extra_args = [["-dnsseed=1"]]
def run_test(self): def run_test(self):
self.init_arg_tests()
self.existing_outbound_connections_test() self.existing_outbound_connections_test()
self.existing_block_relay_connections_test() self.existing_block_relay_connections_test()
def init_arg_tests(self):
fakeaddr = "fakenodeaddr.fakedomain.invalid."
self.log.info("Check that setting -connect disables -dnsseed by default")
self.nodes[0].stop_node()
with self.nodes[0].assert_debug_log(expected_msgs=["DNS seeding disabled"]):
self.start_node(0, [f"-connect={fakeaddr}"])
self.log.info("Check that running -connect and -dnsseed means DNS logic runs.")
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"])
def existing_outbound_connections_test(self): def existing_outbound_connections_test(self):
# Make sure addrman is populated to enter the conditional where we # Make sure addrman is populated to enter the conditional where we
# delay and potentially skip DNS seeding. # delay and potentially skip DNS seeding.