From 185e4b128c449c0509fa6ca7b67ad5275f6dda51 Mon Sep 17 00:00:00 2001 From: pasta Date: Thu, 10 Dec 2020 20:08:07 -0600 Subject: [PATCH] Merge #12443: qa: Move common args to bitcoin.conf face722 qa: Move common args to bitcoin.conf (MarcoFalke) Pull request description: Beside removing duplicates of the same args in the code, this actually helps with debugging after a test failure. For example, `bitcoin-qt` has `server` turned off, so you'd have to turn it on every time, if you wanted to debug a temporary test datadir created by the test framework. Also, `keypool` would fill up if you forget to specify `-keypool=1`. Tree-SHA512: 996bec8738dc0fce7297ab1fc5b4fbe3aa31b9b6241f8c4e685db728925363ccaca6145ad1edc6bee2f360e02ac4b9a53fcdff74eb79de90793393742d52b559 --- test/functional/interface_rest.py | 1 + test/functional/test_framework/test_framework.py | 2 +- test/functional/test_framework/test_node.py | 3 ++- test/functional/test_framework/util.py | 3 +++ 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/test/functional/interface_rest.py b/test/functional/interface_rest.py index 7b8e00d579..9d87f2fc21 100755 --- a/test/functional/interface_rest.py +++ b/test/functional/interface_rest.py @@ -46,6 +46,7 @@ class RESTTest (BitcoinTestFramework): def set_test_params(self): self.setup_clean_chain = True self.num_nodes = 3 + self.extra_args = [["-rest"]] * self.num_nodes def setup_network(self, split=False): super().setup_network() diff --git a/test/functional/test_framework/test_framework.py b/test/functional/test_framework/test_framework.py index 216d47d535..e5f14744a1 100755 --- a/test/functional/test_framework/test_framework.py +++ b/test/functional/test_framework/test_framework.py @@ -445,7 +445,7 @@ class BitcoinTestFramework(): self.set_genesis_mocktime() for i in range(MAX_NODES): datadir = initialize_datadir(self.options.cachedir, i) - args = [self.options.bitcoind, "-server", "-keypool=1", "-datadir=" + datadir, "-discover=0", "-mocktime="+str(GENESISTIME)] + args = [self.options.bitcoind, "-datadir=" + datadir, "-mocktime="+str(GENESISTIME)] if i > 0: args.append("-connect=127.0.0.1:" + str(p2p_port(0))) if extra_args is not None: diff --git a/test/functional/test_framework/test_node.py b/test/functional/test_framework/test_node.py index 064095e457..4d155044af 100755 --- a/test/functional/test_framework/test_node.py +++ b/test/functional/test_framework/test_node.py @@ -68,9 +68,10 @@ class TestNode(): append_config(dirname, i, extra_conf) # Most callers will just need to add extra args to the standard list below. # For those callers that need more flexibity, they can just set the args property directly. + # Note that common args are set in the config file (see initialize_datadir) self.extra_args = extra_args self.extra_args_from_options = extra_args_from_options - self.args = [self.binary, "-datadir=" + self.datadir, "-server", "-keypool=1", "-discover=0", "-rest", "-logtimemicros", "-debug", "-debugexclude=libevent", "-debugexclude=leveldb", "-mocktime=" + str(mocktime), "-uacomment=testnode%d" % i] + self.args = [self.binary, "-datadir=" + self.datadir, "-logtimemicros", "-debug", "-debugexclude=libevent", "-debugexclude=leveldb", "-mocktime=" + str(mocktime), "-uacomment=testnode%d" % i] self.cli = TestNodeCLI(bitcoin_cli, self.datadir) self.use_cli = use_cli diff --git a/test/functional/test_framework/util.py b/test/functional/test_framework/util.py index 4270c92fc9..0f985cafcf 100644 --- a/test/functional/test_framework/util.py +++ b/test/functional/test_framework/util.py @@ -316,6 +316,9 @@ def initialize_datadir(dirname, n): f.write("[regtest]\n") f.write("port=" + str(p2p_port(n)) + "\n") f.write("rpcport=" + str(rpc_port(n)) + "\n") + f.write("server=1\n") + f.write("keypool=1\n") + f.write("discover=0\n") f.write("listenonion=0\n") return datadir