fix: fillow-up Merge #18774: test: added test for upgradewallet RPC

- partial dashification
 - disabling this test so far as it does not work anyway
This commit is contained in:
Konstantin Akimov 2023-08-15 01:35:36 +07:00 committed by PastaPastaPasta
parent eb6347916e
commit f878b281ba
2 changed files with 10 additions and 9 deletions

View File

@ -345,7 +345,7 @@ 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):
def adjust_bitcoin_conf_for_pre_16(conf_file):
with open(conf_file,'r', encoding='utf8') as conf:
conf_data = conf.read()
with open(conf_file, 'w', encoding='utf8') as conf:

View File

@ -12,9 +12,9 @@ import os
import shutil
from test_framework.blocktools import COINBASE_MATURITY
from test_framework.test_framework import BitcoinTestFramework
from test_framework.test_framework import (BitcoinTestFramework, SkipTest)
from test_framework.util import (
adjust_bitcoin_conf_for_pre_17,
adjust_bitcoin_conf_for_pre_16,
assert_equal,
assert_greater_than,
assert_is_hex_string,
@ -26,7 +26,7 @@ class UpgradeWalletTest(BitcoinTestFramework):
self.setup_clean_chain = True
self.num_nodes = 3
self.extra_args = [
["-addresstype=bech32"], # current wallet version
[], # current wallet version
["-usehd=1"], # v0.16.3 wallet
["-usehd=0"] # v0.15.2 wallet
]
@ -36,6 +36,8 @@ class UpgradeWalletTest(BitcoinTestFramework):
self.skip_if_no_wallet()
self.skip_if_no_bdb()
self.skip_if_no_previous_releases()
# TODO: this test doesn't work yet
raise SkipTest("Test wallet_upgradewallet.py is not adapted for Dash Core yet.")
def setup_network(self):
self.setup_nodes()
@ -46,9 +48,8 @@ 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)
# adapt dash.conf, because older dashd's don't recognize config sections
adjust_bitcoin_conf_for_pre_16(self.nodes[2].bitcoinconf)
self.start_nodes()
self.import_deterministic_coinbase_privkeys()
@ -95,7 +96,7 @@ class UpgradeWalletTest(BitcoinTestFramework):
v15_2_wallet = os.path.join(v15_2_node.datadir, "regtest/wallet.dat")
self.stop_nodes()
# Copy the 0.16.3 wallet to the last Bitcoin Core version and open it:
# Copy the 0.16.3 wallet to the last Dash Core version and open it:
shutil.rmtree(node_master_wallet_dir)
os.mkdir(node_master_wallet_dir)
shutil.copy(
@ -118,7 +119,7 @@ class UpgradeWalletTest(BitcoinTestFramework):
assert_equal(wallet.getbalance(), v16_3_balance)
self.stop_node(0)
# Copy the 0.15.2 wallet to the last Bitcoin Core version and open it:
# Copy the 0.15.2 wallet to the last Dash Core version and open it:
shutil.rmtree(node_master_wallet_dir)
os.mkdir(node_master_wallet_dir)
shutil.copy(