From 8ca51af1ece371b6f1bdb88b96f16020cc787d13 Mon Sep 17 00:00:00 2001 From: Martin Zumsande Date: Mon, 26 Jul 2021 17:36:01 +0200 Subject: test: Disable automatic connections by default This prevents the node from trying to connect to random IPs on the internet while running the functional tests. Exceptions are added when required for the test to pass. --- test/functional/test_framework/util.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'test/functional/test_framework/util.py') diff --git a/test/functional/test_framework/util.py b/test/functional/test_framework/util.py index 35dbfbba8d..96839abb0e 100644 --- a/test/functional/test_framework/util.py +++ b/test/functional/test_framework/util.py @@ -338,17 +338,17 @@ def rpc_url(datadir, i, chain, rpchost): ################ -def initialize_datadir(dirname, n, chain): +def initialize_datadir(dirname, n, chain, disable_autoconnect=True): datadir = get_datadir_path(dirname, n) if not os.path.isdir(datadir): os.makedirs(datadir) - write_config(os.path.join(datadir, "bitcoin.conf"), n=n, chain=chain) + write_config(os.path.join(datadir, "bitcoin.conf"), n=n, chain=chain, disable_autoconnect=disable_autoconnect) os.makedirs(os.path.join(datadir, 'stderr'), exist_ok=True) os.makedirs(os.path.join(datadir, 'stdout'), exist_ok=True) return datadir -def write_config(config_path, *, n, chain, extra_config=""): +def write_config(config_path, *, n, chain, extra_config="", disable_autoconnect=True): # Translate chain subdirectory name to config name if chain == 'testnet3': chain_name_conf_arg = 'testnet' @@ -376,6 +376,8 @@ def write_config(config_path, *, n, chain, extra_config=""): f.write("shrinkdebugfile=0\n") # To improve SQLite wallet performance so that the tests don't timeout, use -unsafesqlitesync f.write("unsafesqlitesync=1\n") + if disable_autoconnect: + f.write("connect=0\n") f.write(extra_config) -- cgit v1.2.3