mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-21 22:42:04 +01:00
[test] add v0.17.1 wallet upgrade test
This commit is contained in:
parent
9d9390dab7
commit
b769cd142d
1 changed files with 23 additions and 0 deletions
|
@ -19,6 +19,7 @@ import os
|
|||
import shutil
|
||||
|
||||
from test_framework.test_framework import BitcoinTestFramework, SkipTest
|
||||
from test_framework.descriptors import descsum_create
|
||||
|
||||
from test_framework.util import (
|
||||
assert_equal,
|
||||
|
@ -240,6 +241,28 @@ class BackwardsCompatibilityTest(BitcoinTestFramework):
|
|||
self.stop_node(self.num_nodes - 1)
|
||||
node_v17.assert_start_raises_init_error(["-wallet=w3_v18"], "Error: Error loading w3_v18: Wallet requires newer version of Bitcoin Core")
|
||||
node_v17.assert_start_raises_init_error(["-wallet=w3"], "Error: Error loading w3: Wallet requires newer version of Bitcoin Core")
|
||||
self.start_node(self.num_nodes - 1)
|
||||
|
||||
self.log.info("Test wallet upgrade path...")
|
||||
# u1: regular wallet, created with v0.17
|
||||
node_v17.createwallet(wallet_name="u1_v17")
|
||||
wallet = node_v17.get_wallet_rpc("u1_v17")
|
||||
address = wallet.getnewaddress("bech32")
|
||||
info = wallet.getaddressinfo(address)
|
||||
hdkeypath = info["hdkeypath"]
|
||||
pubkey = info["pubkey"]
|
||||
|
||||
# Copy the wallet to the last Bitcoin Core version and open it:
|
||||
node_v17.unloadwallet("u1_v17")
|
||||
shutil.copytree(
|
||||
os.path.join(node_v17_wallets_dir, "u1_v17"),
|
||||
os.path.join(node_master_wallets_dir, "u1_v17")
|
||||
)
|
||||
node_master.loadwallet("u1_v17")
|
||||
wallet = node_master.get_wallet_rpc("u1_v17")
|
||||
info = wallet.getaddressinfo(address)
|
||||
descriptor = "wpkh([" + info["hdmasterfingerprint"] + hdkeypath[1:] + "]" + pubkey + ")"
|
||||
assert_equal(info["desc"], descsum_create(descriptor))
|
||||
|
||||
if __name__ == '__main__':
|
||||
BackwardsCompatibilityTest().main()
|
||||
|
|
Loading…
Add table
Reference in a new issue