mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-03-05 14:06:27 -05:00
Disable upgrades tests that require BDB if BDB is not compiled
This commit is contained in:
parent
1f20cac9d4
commit
c77975abc0
1 changed files with 64 additions and 62 deletions
|
@ -354,73 +354,75 @@ class BackwardsCompatibilityTest(BitcoinTestFramework):
|
||||||
hdkeypath = v17_info["hdkeypath"]
|
hdkeypath = v17_info["hdkeypath"]
|
||||||
pubkey = v17_info["pubkey"]
|
pubkey = v17_info["pubkey"]
|
||||||
|
|
||||||
# Copy the 0.16 wallet to the last Bitcoin Core version and open it:
|
if self.is_bdb_compiled():
|
||||||
shutil.copyfile(
|
# Old wallets are BDB and will only work if BDB is compiled
|
||||||
os.path.join(node_v16_wallets_dir, "wallets/u1_v16"),
|
# Copy the 0.16 wallet to the last Bitcoin Core version and open it:
|
||||||
os.path.join(node_master_wallets_dir, "u1_v16")
|
shutil.copyfile(
|
||||||
)
|
os.path.join(node_v16_wallets_dir, "wallets/u1_v16"),
|
||||||
load_res = node_master.loadwallet("u1_v16")
|
os.path.join(node_master_wallets_dir, "u1_v16")
|
||||||
# Make sure this wallet opens without warnings. See https://github.com/bitcoin/bitcoin/pull/19054
|
)
|
||||||
assert_equal(load_res['warning'], '')
|
load_res = node_master.loadwallet("u1_v16")
|
||||||
wallet = node_master.get_wallet_rpc("u1_v16")
|
# Make sure this wallet opens without warnings. See https://github.com/bitcoin/bitcoin/pull/19054
|
||||||
info = wallet.getaddressinfo(v16_addr)
|
assert_equal(load_res['warning'], '')
|
||||||
descriptor = "wpkh([" + info["hdmasterfingerprint"] + hdkeypath[1:] + "]" + v16_pubkey + ")"
|
wallet = node_master.get_wallet_rpc("u1_v16")
|
||||||
assert_equal(info["desc"], descsum_create(descriptor))
|
info = wallet.getaddressinfo(v16_addr)
|
||||||
|
descriptor = "wpkh([" + info["hdmasterfingerprint"] + hdkeypath[1:] + "]" + v16_pubkey + ")"
|
||||||
|
assert_equal(info["desc"], descsum_create(descriptor))
|
||||||
|
|
||||||
# Now copy that same wallet back to 0.16 to make sure no automatic upgrade breaks it
|
# Now copy that same wallet back to 0.16 to make sure no automatic upgrade breaks it
|
||||||
os.remove(os.path.join(node_v16_wallets_dir, "wallets/u1_v16"))
|
os.remove(os.path.join(node_v16_wallets_dir, "wallets/u1_v16"))
|
||||||
shutil.copyfile(
|
shutil.copyfile(
|
||||||
os.path.join(node_master_wallets_dir, "u1_v16"),
|
os.path.join(node_master_wallets_dir, "u1_v16"),
|
||||||
os.path.join(node_v16_wallets_dir, "wallets/u1_v16")
|
os.path.join(node_v16_wallets_dir, "wallets/u1_v16")
|
||||||
)
|
)
|
||||||
self.start_node(-1, extra_args=["-wallet=u1_v16"])
|
self.start_node(-1, extra_args=["-wallet=u1_v16"])
|
||||||
wallet = node_v16.get_wallet_rpc("u1_v16")
|
wallet = node_v16.get_wallet_rpc("u1_v16")
|
||||||
info = wallet.validateaddress(v16_addr)
|
info = wallet.validateaddress(v16_addr)
|
||||||
assert_equal(info, v16_info)
|
assert_equal(info, v16_info)
|
||||||
|
|
||||||
# Copy the 0.17 wallet to the last Bitcoin Core version and open it:
|
# Copy the 0.17 wallet to the last Bitcoin Core version and open it:
|
||||||
node_v17.unloadwallet("u1_v17")
|
node_v17.unloadwallet("u1_v17")
|
||||||
shutil.copytree(
|
shutil.copytree(
|
||||||
os.path.join(node_v17_wallets_dir, "u1_v17"),
|
os.path.join(node_v17_wallets_dir, "u1_v17"),
|
||||||
os.path.join(node_master_wallets_dir, "u1_v17")
|
os.path.join(node_master_wallets_dir, "u1_v17")
|
||||||
)
|
)
|
||||||
node_master.loadwallet("u1_v17")
|
node_master.loadwallet("u1_v17")
|
||||||
wallet = node_master.get_wallet_rpc("u1_v17")
|
wallet = node_master.get_wallet_rpc("u1_v17")
|
||||||
info = wallet.getaddressinfo(address)
|
info = wallet.getaddressinfo(address)
|
||||||
descriptor = "wpkh([" + info["hdmasterfingerprint"] + hdkeypath[1:] + "]" + pubkey + ")"
|
descriptor = "wpkh([" + info["hdmasterfingerprint"] + hdkeypath[1:] + "]" + pubkey + ")"
|
||||||
assert_equal(info["desc"], descsum_create(descriptor))
|
assert_equal(info["desc"], descsum_create(descriptor))
|
||||||
|
|
||||||
# Now copy that same wallet back to 0.17 to make sure no automatic upgrade breaks it
|
# Now copy that same wallet back to 0.17 to make sure no automatic upgrade breaks it
|
||||||
node_master.unloadwallet("u1_v17")
|
node_master.unloadwallet("u1_v17")
|
||||||
shutil.rmtree(os.path.join(node_v17_wallets_dir, "u1_v17"))
|
shutil.rmtree(os.path.join(node_v17_wallets_dir, "u1_v17"))
|
||||||
shutil.copytree(
|
shutil.copytree(
|
||||||
os.path.join(node_master_wallets_dir, "u1_v17"),
|
os.path.join(node_master_wallets_dir, "u1_v17"),
|
||||||
os.path.join(node_v17_wallets_dir, "u1_v17")
|
os.path.join(node_v17_wallets_dir, "u1_v17")
|
||||||
)
|
)
|
||||||
node_v17.loadwallet("u1_v17")
|
node_v17.loadwallet("u1_v17")
|
||||||
wallet = node_v17.get_wallet_rpc("u1_v17")
|
wallet = node_v17.get_wallet_rpc("u1_v17")
|
||||||
info = wallet.getaddressinfo(address)
|
info = wallet.getaddressinfo(address)
|
||||||
assert_equal(info, v17_info)
|
assert_equal(info, v17_info)
|
||||||
|
|
||||||
# Copy the 0.19 wallet to the last Bitcoin Core version and open it:
|
# Copy the 0.19 wallet to the last Bitcoin Core version and open it:
|
||||||
shutil.copytree(
|
shutil.copytree(
|
||||||
os.path.join(node_v19_wallets_dir, "w1_v19"),
|
os.path.join(node_v19_wallets_dir, "w1_v19"),
|
||||||
os.path.join(node_master_wallets_dir, "w1_v19")
|
os.path.join(node_master_wallets_dir, "w1_v19")
|
||||||
)
|
)
|
||||||
node_master.loadwallet("w1_v19")
|
node_master.loadwallet("w1_v19")
|
||||||
wallet = node_master.get_wallet_rpc("w1_v19")
|
wallet = node_master.get_wallet_rpc("w1_v19")
|
||||||
assert wallet.getaddressinfo(address_18075)["solvable"]
|
assert wallet.getaddressinfo(address_18075)["solvable"]
|
||||||
|
|
||||||
# Now copy that same wallet back to 0.19 to make sure no automatic upgrade breaks it
|
# Now copy that same wallet back to 0.19 to make sure no automatic upgrade breaks it
|
||||||
node_master.unloadwallet("w1_v19")
|
node_master.unloadwallet("w1_v19")
|
||||||
shutil.rmtree(os.path.join(node_v19_wallets_dir, "w1_v19"))
|
shutil.rmtree(os.path.join(node_v19_wallets_dir, "w1_v19"))
|
||||||
shutil.copytree(
|
shutil.copytree(
|
||||||
os.path.join(node_master_wallets_dir, "w1_v19"),
|
os.path.join(node_master_wallets_dir, "w1_v19"),
|
||||||
os.path.join(node_v19_wallets_dir, "w1_v19")
|
os.path.join(node_v19_wallets_dir, "w1_v19")
|
||||||
)
|
)
|
||||||
node_v19.loadwallet("w1_v19")
|
node_v19.loadwallet("w1_v19")
|
||||||
wallet = node_v19.get_wallet_rpc("w1_v19")
|
wallet = node_v19.get_wallet_rpc("w1_v19")
|
||||||
assert wallet.getaddressinfo(address_18075)["solvable"]
|
assert wallet.getaddressinfo(address_18075)["solvable"]
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
BackwardsCompatibilityTest().main()
|
BackwardsCompatibilityTest().main()
|
||||||
|
|
Loading…
Add table
Reference in a new issue