mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-21 12:22:50 -05:00
test: Add test to make sure -noconnect disables -dnsseed and -listen by default
Make sure -noconnect has same effect as -connect for disabling DNS seeding and listening by default, and warning about -dnsseed being ignored with the -proxy setting. Initial implementation of https://github.com/bitcoin/bitcoin/pull/30529 accidentally broke this behavior, so having coverage may be useful to make sure it does not break again. Co-authored-by: Hodlinator <172445034+hodlinator@users.noreply.github.com>
This commit is contained in:
parent
3c2920ec98
commit
752ab9c3c6
1 changed files with 15 additions and 0 deletions
|
@ -369,6 +369,8 @@ class ConfArgsTest(BitcoinTestFramework):
|
|||
seednode_ignored = ['-seednode is ignored when -connect is used\n']
|
||||
dnsseed_ignored = ['-dnsseed is ignored when -connect is used and -proxy is specified\n']
|
||||
addcon_thread_started = ['addcon thread start\n']
|
||||
dnsseed_disabled = "parameter interaction: -connect or -maxconnections=0 set -> setting -dnsseed=0"
|
||||
listen_disabled = "parameter interaction: -connect or -maxconnections=0 set -> setting -listen=0"
|
||||
|
||||
# When -connect is supplied, expanding addrman via getaddr calls to ADDR_FETCH(-seednode)
|
||||
# nodes is irrelevant and -seednode is ignored.
|
||||
|
@ -393,6 +395,19 @@ class ConfArgsTest(BitcoinTestFramework):
|
|||
with self.nodes[0].assert_debug_log(expected_msgs=addcon_thread_started,
|
||||
unexpected_msgs=seednode_ignored):
|
||||
self.restart_node(0, extra_args=[connect_arg, '-seednode=fakeaddress2'])
|
||||
|
||||
# Make sure -noconnect soft-disables -listen and -dnsseed.
|
||||
# Need to temporarily remove these settings from the config file in
|
||||
# order for the two log messages to appear
|
||||
self.nodes[0].replace_in_config([("bind=", "#bind="), ("dnsseed=", "#dnsseed=")])
|
||||
with self.nodes[0].assert_debug_log(expected_msgs=[dnsseed_disabled, listen_disabled]):
|
||||
self.restart_node(0, extra_args=[connect_arg])
|
||||
self.nodes[0].replace_in_config([("#bind=", "bind="), ("#dnsseed=", "dnsseed=")])
|
||||
|
||||
# Make sure -proxy and -noconnect warn about -dnsseed setting being
|
||||
# ignored, just like -proxy and -connect do.
|
||||
with self.nodes[0].assert_debug_log(expected_msgs=dnsseed_ignored):
|
||||
self.restart_node(0, extra_args=[connect_arg, '-dnsseed', '-proxy=localhost:1080'])
|
||||
self.stop_node(0)
|
||||
|
||||
def test_ignored_conf(self):
|
||||
|
|
Loading…
Add table
Reference in a new issue