Skip to content

Commit

Permalink
fix: fillow-up Merge bitcoin#18774: test: added test for upgradewalle…
Browse files Browse the repository at this point in the history
…t RPC

 - partial dashification
 - disabling this test so far as it does not work anyway
  • Loading branch information
knst committed Aug 21, 2023
1 parent be42204 commit 0642835
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion test/functional/test_framework/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
17 changes: 9 additions & 8 deletions test/functional/wallet_upgradewallet.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
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,
Expand All @@ -26,7 +26,7 @@ def set_test_params(self):
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
]
Expand All @@ -36,6 +36,8 @@ def skip_test_if_missing_module(self):
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()
Expand All @@ -46,9 +48,8 @@ def setup_nodes(self):
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()

Expand Down Expand Up @@ -95,7 +96,7 @@ def run_test(self):
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(
Expand All @@ -118,7 +119,7 @@ def run_test(self):
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(
Expand Down

0 comments on commit 0642835

Please sign in to comment.