Skip to content

Commit 446d480

Browse files
committed
test: Remove legacy wallet tests from wallet_backwards_compatibility.py
1 parent aff8029 commit 446d480

File tree

2 files changed

+21
-31
lines changed

2 files changed

+21
-31
lines changed

test/functional/test_runner.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,6 @@
278278
'wallet_multisig_descriptor_psbt.py --descriptors',
279279
'wallet_miniscript_decaying_multisig_descriptor_psbt.py --descriptors',
280280
'wallet_txn_doublespend.py --descriptors',
281-
'wallet_backwards_compatibility.py --legacy-wallet',
282281
'wallet_backwards_compatibility.py --descriptors',
283282
'wallet_txn_clone.py --mineblock',
284283
'feature_notifications.py',

test/functional/wallet_backwards_compatibility.py

Lines changed: 21 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030
class BackwardsCompatibilityTest(BitcoinTestFramework):
3131
def add_options(self, parser):
32-
self.add_wallet_options(parser)
32+
self.add_wallet_options(parser, legacy=False)
3333

3434
def set_test_params(self):
3535
self.setup_clean_chain = True
@@ -204,12 +204,12 @@ def run_test(self):
204204
self.test_v19_addmultisigaddress()
205205

206206
self.log.info("Test that a wallet made on master can be opened on:")
207-
# In descriptors wallet mode, run this test on the nodes that support descriptor wallets
208-
# In legacy wallets mode, run this test on the nodes that support legacy wallets
209-
for node in descriptors_nodes if self.options.descriptors else legacy_nodes:
207+
# This test only works on the nodes that support descriptor wallets
208+
# since we can no longer create legacy wallets.
209+
for node in descriptors_nodes:
210210
self.log.info(f"- {node.version}")
211211
for wallet_name in ["w1", "w2", "w3"]:
212-
if self.major_version_less_than(node, 22) and wallet_name == "w1" and self.options.descriptors:
212+
if self.major_version_less_than(node, 22) and wallet_name == "w1":
213213
# Descriptor wallets created after 0.21 have taproot descriptors which 0.21 does not support, tested below
214214
continue
215215
# Also try to reopen on master after opening on old
@@ -249,28 +249,23 @@ def run_test(self):
249249
)
250250

251251
# Check that descriptor wallets don't work on legacy only nodes
252-
if self.options.descriptors:
253-
self.log.info("Test descriptor wallet incompatibility on:")
254-
for node in legacy_only_nodes:
255-
self.log.info(f"- {node.version}")
256-
# Descriptor wallets appear to be corrupted wallets to old software
257-
assert self.major_version_less_than(node, 21)
258-
for wallet_name in ["w1", "w2", "w3"]:
259-
assert_raises_rpc_error(-4, "Wallet file verification failed: wallet.dat corrupt, salvage failed", node.loadwallet, wallet_name)
260-
261-
# When descriptors are enabled, w1 cannot be opened by 0.21 since it contains a taproot descriptor
262-
if self.options.descriptors:
263-
self.log.info("Test that 0.21 cannot open wallet containing tr() descriptors")
264-
assert_raises_rpc_error(-1, "map::at", node_v21.loadwallet, "w1")
252+
self.log.info("Test descriptor wallet incompatibility on:")
253+
for node in legacy_only_nodes:
254+
self.log.info(f"- {node.version}")
255+
# Descriptor wallets appear to be corrupted wallets to old software
256+
assert self.major_version_less_than(node, 21)
257+
for wallet_name in ["w1", "w2", "w3"]:
258+
assert_raises_rpc_error(-4, "Wallet file verification failed: wallet.dat corrupt, salvage failed", node.loadwallet, wallet_name)
259+
260+
# w1 cannot be opened by 0.21 since it contains a taproot descriptor
261+
self.log.info("Test that 0.21 cannot open wallet containing tr() descriptors")
262+
assert_raises_rpc_error(-1, "map::at", node_v21.loadwallet, "w1")
265263

266264
self.log.info("Test that a wallet can upgrade to and downgrade from master, from:")
267-
for node in descriptors_nodes if self.options.descriptors else legacy_nodes:
265+
for node in descriptors_nodes:
268266
self.log.info(f"- {node.version}")
269267
wallet_name = f"up_{node.version}"
270-
if self.major_version_at_least(node, 21):
271-
node.rpc.createwallet(wallet_name=wallet_name, descriptors=self.options.descriptors)
272-
else:
273-
node.rpc.createwallet(wallet_name=wallet_name)
268+
node.rpc.createwallet(wallet_name=wallet_name, descriptors=True)
274269
wallet_prev = node.get_wallet_rpc(wallet_name)
275270
address = wallet_prev.getnewaddress('', "bech32")
276271
addr_info = wallet_prev.getaddressinfo(address)
@@ -288,12 +283,8 @@ def run_test(self):
288283
# Restore the wallet to master
289284
load_res = node_master.restorewallet(wallet_name, backup_path)
290285

291-
# Make sure this wallet opens with only the migration warning. See https://github.com/bitcoin/bitcoin/pull/19054
292-
if not self.options.descriptors:
293-
# Legacy wallets will have only a deprecation warning
294-
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."])
295-
else:
296-
assert "warnings" not in load_res
286+
# There should be no warnings
287+
assert "warnings" not in load_res
297288

298289
wallet = node_master.get_wallet_rpc(wallet_name)
299290
info = wallet.getaddressinfo(address)
@@ -308,7 +299,7 @@ def run_test(self):
308299
# Check that taproot descriptors can be added to 0.21 wallets
309300
# This must be done after the backup is created so that 0.21 can still load
310301
# the backup
311-
if self.options.descriptors and self.major_version_equals(node, 21):
302+
if self.major_version_equals(node, 21):
312303
assert_raises_rpc_error(-12, "No bech32m addresses available", wallet.getnewaddress, address_type="bech32m")
313304
xpubs = wallet.gethdkeys(active_only=True)
314305
assert_equal(len(xpubs), 1)

0 commit comments

Comments
 (0)