diff options
author | MarcoFalke <falke.marco@gmail.com> | 2020-06-16 07:39:18 -0400 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2020-06-16 08:27:57 -0400 |
commit | faa841bc979ca306f5ba4d5f7b78fcc427b8e413 (patch) | |
tree | e3fbfeadec7eed9b5070ecdea2759120cb4a9d54 /test/functional/test_framework | |
parent | 0afbeb73ccb7523794e1e4a3422607c4423d1048 (diff) | |
download | bitcoin-faa841bc979ca306f5ba4d5f7b78fcc427b8e413.tar.xz |
test: refactor: Inline adjust_bitcoin_conf_for_pre_17
Diffstat (limited to 'test/functional/test_framework')
-rwxr-xr-x | test/functional/test_framework/test_framework.py | 12 | ||||
-rw-r--r-- | test/functional/test_framework/util.py | 6 |
2 files changed, 10 insertions, 8 deletions
diff --git a/test/functional/test_framework/test_framework.py b/test/functional/test_framework/test_framework.py index 9f5e9e5f0d..c9fad91481 100755 --- a/test/functional/test_framework/test_framework.py +++ b/test/functional/test_framework/test_framework.py @@ -452,7 +452,7 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass): assert_equal(len(binary), num_nodes) assert_equal(len(binary_cli), num_nodes) for i in range(num_nodes): - self.nodes.append(TestNode( + test_node_i = TestNode( i, get_datadir_path(self.options.tmpdir, i), chain=self.chain, @@ -470,7 +470,15 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass): start_perf=self.options.perf, use_valgrind=self.options.valgrind, descriptors=self.options.descriptors, - )) + ) + self.nodes.append(test_node_i) + if not test_node_i.version_is_at_least(170000): + # adjust conf for pre 17 + conf_file = test_node_i.bitcoinconf + with open(conf_file, 'r', encoding='utf8') as conf: + conf_data = conf.read() + with open(conf_file, 'w', encoding='utf8') as conf: + conf.write(conf_data.replace('[regtest]', '')) def start_node(self, i, *args, **kwargs): """Start a bitcoind""" diff --git a/test/functional/test_framework/util.py b/test/functional/test_framework/util.py index 52306c8c3d..f1e8cc95c8 100644 --- a/test/functional/test_framework/util.py +++ b/test/functional/test_framework/util.py @@ -327,12 +327,6 @@ def initialize_datadir(dirname, n, chain): os.makedirs(os.path.join(datadir, 'stdout'), exist_ok=True) return datadir -def adjust_bitcoin_conf_for_pre_17(conf_file): - with open(conf_file,'r', encoding='utf8') as conf: - conf_data = conf.read() - with open(conf_file, 'w', encoding='utf8') as conf: - conf_data_changed = conf_data.replace('[regtest]', '') - conf.write(conf_data_changed) def get_datadir_path(dirname, n): return os.path.join(dirname, "node" + str(n)) |