mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-04-29 14:59:39 -04:00
test: Remove legacy wallet tests from wallet_backwards_compatibility.py
This commit is contained in:
parent
aff80298d0
commit
446d480cb2
2 changed files with 20 additions and 30 deletions
|
@ -278,7 +278,6 @@ BASE_SCRIPTS = [
|
|||
'wallet_multisig_descriptor_psbt.py --descriptors',
|
||||
'wallet_miniscript_decaying_multisig_descriptor_psbt.py --descriptors',
|
||||
'wallet_txn_doublespend.py --descriptors',
|
||||
'wallet_backwards_compatibility.py --legacy-wallet',
|
||||
'wallet_backwards_compatibility.py --descriptors',
|
||||
'wallet_txn_clone.py --mineblock',
|
||||
'feature_notifications.py',
|
||||
|
|
|
@ -29,7 +29,7 @@ from test_framework.util import (
|
|||
|
||||
class BackwardsCompatibilityTest(BitcoinTestFramework):
|
||||
def add_options(self, parser):
|
||||
self.add_wallet_options(parser)
|
||||
self.add_wallet_options(parser, legacy=False)
|
||||
|
||||
def set_test_params(self):
|
||||
self.setup_clean_chain = True
|
||||
|
@ -204,12 +204,12 @@ class BackwardsCompatibilityTest(BitcoinTestFramework):
|
|||
self.test_v19_addmultisigaddress()
|
||||
|
||||
self.log.info("Test that a wallet made on master can be opened on:")
|
||||
# In descriptors wallet mode, run this test on the nodes that support descriptor wallets
|
||||
# In legacy wallets mode, run this test on the nodes that support legacy wallets
|
||||
for node in descriptors_nodes if self.options.descriptors else legacy_nodes:
|
||||
# This test only works on the nodes that support descriptor wallets
|
||||
# since we can no longer create legacy wallets.
|
||||
for node in descriptors_nodes:
|
||||
self.log.info(f"- {node.version}")
|
||||
for wallet_name in ["w1", "w2", "w3"]:
|
||||
if self.major_version_less_than(node, 22) and wallet_name == "w1" and self.options.descriptors:
|
||||
if self.major_version_less_than(node, 22) and wallet_name == "w1":
|
||||
# Descriptor wallets created after 0.21 have taproot descriptors which 0.21 does not support, tested below
|
||||
continue
|
||||
# Also try to reopen on master after opening on old
|
||||
|
@ -249,7 +249,6 @@ class BackwardsCompatibilityTest(BitcoinTestFramework):
|
|||
)
|
||||
|
||||
# Check that descriptor wallets don't work on legacy only nodes
|
||||
if self.options.descriptors:
|
||||
self.log.info("Test descriptor wallet incompatibility on:")
|
||||
for node in legacy_only_nodes:
|
||||
self.log.info(f"- {node.version}")
|
||||
|
@ -258,19 +257,15 @@ class BackwardsCompatibilityTest(BitcoinTestFramework):
|
|||
for wallet_name in ["w1", "w2", "w3"]:
|
||||
assert_raises_rpc_error(-4, "Wallet file verification failed: wallet.dat corrupt, salvage failed", node.loadwallet, wallet_name)
|
||||
|
||||
# When descriptors are enabled, w1 cannot be opened by 0.21 since it contains a taproot descriptor
|
||||
if self.options.descriptors:
|
||||
# w1 cannot be opened by 0.21 since it contains a taproot descriptor
|
||||
self.log.info("Test that 0.21 cannot open wallet containing tr() descriptors")
|
||||
assert_raises_rpc_error(-1, "map::at", node_v21.loadwallet, "w1")
|
||||
|
||||
self.log.info("Test that a wallet can upgrade to and downgrade from master, from:")
|
||||
for node in descriptors_nodes if self.options.descriptors else legacy_nodes:
|
||||
for node in descriptors_nodes:
|
||||
self.log.info(f"- {node.version}")
|
||||
wallet_name = f"up_{node.version}"
|
||||
if self.major_version_at_least(node, 21):
|
||||
node.rpc.createwallet(wallet_name=wallet_name, descriptors=self.options.descriptors)
|
||||
else:
|
||||
node.rpc.createwallet(wallet_name=wallet_name)
|
||||
node.rpc.createwallet(wallet_name=wallet_name, descriptors=True)
|
||||
wallet_prev = node.get_wallet_rpc(wallet_name)
|
||||
address = wallet_prev.getnewaddress('', "bech32")
|
||||
addr_info = wallet_prev.getaddressinfo(address)
|
||||
|
@ -288,11 +283,7 @@ class BackwardsCompatibilityTest(BitcoinTestFramework):
|
|||
# Restore the wallet to master
|
||||
load_res = node_master.restorewallet(wallet_name, backup_path)
|
||||
|
||||
# Make sure this wallet opens with only the migration warning. See https://github.com/bitcoin/bitcoin/pull/19054
|
||||
if not self.options.descriptors:
|
||||
# Legacy wallets will have only a deprecation warning
|
||||
assert_equal(load_res["warnings"], ["Wallet loaded successfully. The legacy wallet type is being deprecated and support for creating and opening legacy wallets will be removed in the future. Legacy wallets can be migrated to a descriptor wallet with migratewallet."])
|
||||
else:
|
||||
# There should be no warnings
|
||||
assert "warnings" not in load_res
|
||||
|
||||
wallet = node_master.get_wallet_rpc(wallet_name)
|
||||
|
@ -308,7 +299,7 @@ class BackwardsCompatibilityTest(BitcoinTestFramework):
|
|||
# Check that taproot descriptors can be added to 0.21 wallets
|
||||
# This must be done after the backup is created so that 0.21 can still load
|
||||
# the backup
|
||||
if self.options.descriptors and self.major_version_equals(node, 21):
|
||||
if self.major_version_equals(node, 21):
|
||||
assert_raises_rpc_error(-12, "No bech32m addresses available", wallet.getnewaddress, address_type="bech32m")
|
||||
xpubs = wallet.gethdkeys(active_only=True)
|
||||
assert_equal(len(xpubs), 1)
|
||||
|
|
Loading…
Add table
Reference in a new issue