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.
This commit is contained in:
1 parent
54e31742d2
commit
8ca51af1ec
4 files changed
+13
-6
No files matched your search
@@ -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)
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user