mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-25 10:43:19 -03:00
test: refactor: Inline adjust_bitcoin_conf_for_pre_17
This commit is contained in:
parent
0afbeb73cc
commit
faa841bc97
5 changed files with 11 additions and 19 deletions
|
@ -26,7 +26,6 @@ from test_framework.test_framework import BitcoinTestFramework
|
|||
from test_framework.descriptors import descsum_create
|
||||
|
||||
from test_framework.util import (
|
||||
adjust_bitcoin_conf_for_pre_17,
|
||||
assert_equal,
|
||||
sync_blocks,
|
||||
sync_mempools,
|
||||
|
@ -60,8 +59,6 @@ class BackwardsCompatibilityTest(BitcoinTestFramework):
|
|||
170100,
|
||||
160300,
|
||||
])
|
||||
# adapt bitcoin.conf, because older bitcoind's don't recognize config sections
|
||||
adjust_bitcoin_conf_for_pre_17(self.nodes[5].bitcoinconf)
|
||||
|
||||
self.start_nodes()
|
||||
|
||||
|
|
|
@ -16,9 +16,7 @@ Only v0.15.2 is required by this test. The rest is used in other backwards compa
|
|||
import os
|
||||
|
||||
from test_framework.test_framework import BitcoinTestFramework
|
||||
from test_framework.util import (
|
||||
adjust_bitcoin_conf_for_pre_17
|
||||
)
|
||||
|
||||
|
||||
class MempoolCompatibilityTest(BitcoinTestFramework):
|
||||
def set_test_params(self):
|
||||
|
@ -33,7 +31,6 @@ class MempoolCompatibilityTest(BitcoinTestFramework):
|
|||
150200, # oldest version supported by the test framework
|
||||
None,
|
||||
])
|
||||
adjust_bitcoin_conf_for_pre_17(self.nodes[0].bitcoinconf)
|
||||
self.start_nodes()
|
||||
self.import_deterministic_coinbase_privkeys()
|
||||
|
||||
|
|
|
@ -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"""
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -16,7 +16,6 @@ import shutil
|
|||
|
||||
from test_framework.test_framework import BitcoinTestFramework
|
||||
from test_framework.util import (
|
||||
adjust_bitcoin_conf_for_pre_17,
|
||||
assert_equal,
|
||||
assert_greater_than,
|
||||
assert_is_hex_string,
|
||||
|
@ -46,9 +45,6 @@ class UpgradeWalletTest(BitcoinTestFramework):
|
|||
160300,
|
||||
150200,
|
||||
])
|
||||
# adapt bitcoin.conf, because older bitcoind's don't recognize config sections
|
||||
adjust_bitcoin_conf_for_pre_17(self.nodes[1].bitcoinconf)
|
||||
adjust_bitcoin_conf_for_pre_17(self.nodes[2].bitcoinconf)
|
||||
self.start_nodes()
|
||||
|
||||
def dumb_sync_blocks(self):
|
||||
|
|
Loading…
Add table
Reference in a new issue