mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-07-08 17:30:36 +02:00
test: refactor: Inline adjust_bitcoin_conf_for_pre_17
This commit is contained in:
@ -26,7 +26,6 @@ from test_framework.test_framework import BitcoinTestFramework
|
|||||||
from test_framework.descriptors import descsum_create
|
from test_framework.descriptors import descsum_create
|
||||||
|
|
||||||
from test_framework.util import (
|
from test_framework.util import (
|
||||||
adjust_bitcoin_conf_for_pre_17,
|
|
||||||
assert_equal,
|
assert_equal,
|
||||||
sync_blocks,
|
sync_blocks,
|
||||||
sync_mempools,
|
sync_mempools,
|
||||||
@ -60,8 +59,6 @@ class BackwardsCompatibilityTest(BitcoinTestFramework):
|
|||||||
170100,
|
170100,
|
||||||
160300,
|
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()
|
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
|
import os
|
||||||
|
|
||||||
from test_framework.test_framework import BitcoinTestFramework
|
from test_framework.test_framework import BitcoinTestFramework
|
||||||
from test_framework.util import (
|
|
||||||
adjust_bitcoin_conf_for_pre_17
|
|
||||||
)
|
|
||||||
|
|
||||||
class MempoolCompatibilityTest(BitcoinTestFramework):
|
class MempoolCompatibilityTest(BitcoinTestFramework):
|
||||||
def set_test_params(self):
|
def set_test_params(self):
|
||||||
@ -33,7 +31,6 @@ class MempoolCompatibilityTest(BitcoinTestFramework):
|
|||||||
150200, # oldest version supported by the test framework
|
150200, # oldest version supported by the test framework
|
||||||
None,
|
None,
|
||||||
])
|
])
|
||||||
adjust_bitcoin_conf_for_pre_17(self.nodes[0].bitcoinconf)
|
|
||||||
self.start_nodes()
|
self.start_nodes()
|
||||||
self.import_deterministic_coinbase_privkeys()
|
self.import_deterministic_coinbase_privkeys()
|
||||||
|
|
||||||
|
@ -452,7 +452,7 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass):
|
|||||||
assert_equal(len(binary), num_nodes)
|
assert_equal(len(binary), num_nodes)
|
||||||
assert_equal(len(binary_cli), num_nodes)
|
assert_equal(len(binary_cli), num_nodes)
|
||||||
for i in range(num_nodes):
|
for i in range(num_nodes):
|
||||||
self.nodes.append(TestNode(
|
test_node_i = TestNode(
|
||||||
i,
|
i,
|
||||||
get_datadir_path(self.options.tmpdir, i),
|
get_datadir_path(self.options.tmpdir, i),
|
||||||
chain=self.chain,
|
chain=self.chain,
|
||||||
@ -470,7 +470,15 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass):
|
|||||||
start_perf=self.options.perf,
|
start_perf=self.options.perf,
|
||||||
use_valgrind=self.options.valgrind,
|
use_valgrind=self.options.valgrind,
|
||||||
descriptors=self.options.descriptors,
|
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):
|
def start_node(self, i, *args, **kwargs):
|
||||||
"""Start a bitcoind"""
|
"""Start a bitcoind"""
|
||||||
|
@ -327,12 +327,6 @@ def initialize_datadir(dirname, n, chain):
|
|||||||
os.makedirs(os.path.join(datadir, 'stdout'), exist_ok=True)
|
os.makedirs(os.path.join(datadir, 'stdout'), exist_ok=True)
|
||||||
return datadir
|
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):
|
def get_datadir_path(dirname, n):
|
||||||
return os.path.join(dirname, "node" + str(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.test_framework import BitcoinTestFramework
|
||||||
from test_framework.util import (
|
from test_framework.util import (
|
||||||
adjust_bitcoin_conf_for_pre_17,
|
|
||||||
assert_equal,
|
assert_equal,
|
||||||
assert_greater_than,
|
assert_greater_than,
|
||||||
assert_is_hex_string,
|
assert_is_hex_string,
|
||||||
@ -46,9 +45,6 @@ class UpgradeWalletTest(BitcoinTestFramework):
|
|||||||
160300,
|
160300,
|
||||||
150200,
|
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()
|
self.start_nodes()
|
||||||
|
|
||||||
def dumb_sync_blocks(self):
|
def dumb_sync_blocks(self):
|
||||||
|
Reference in New Issue
Block a user