Skip to content

Commit 2402b63

Browse files
committed
wallet: Test upgrade of pre-taproot wallet to have tr() descriptors
1 parent 460ae1b commit 2402b63

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

test/functional/wallet_backwards_compatibility.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,25 @@ def run_test(self):
355355
down_wallet_name = f"re_down_{node.version}"
356356
down_backup_path = os.path.join(self.options.tmpdir, f"{down_wallet_name}.dat")
357357
wallet.backupwallet(down_backup_path)
358+
359+
# Check that taproot descriptors can be added to 0.21 wallets
360+
# This must be done after the backup is created so that 0.21 can still load
361+
# the backup
362+
if self.options.descriptors and self.major_version_equals(node, 21):
363+
assert_raises_rpc_error(-12, "No bech32m addresses available", wallet.getnewaddress, address_type="bech32m")
364+
xpubs = wallet.gethdkeys(active_only=True)
365+
assert_equal(len(xpubs), 1)
366+
assert_equal(len(xpubs[0]["descriptors"]), 6)
367+
wallet.createwalletdescriptor("bech32m")
368+
xpubs = wallet.gethdkeys(active_only=True)
369+
assert_equal(len(xpubs), 1)
370+
assert_equal(len(xpubs[0]["descriptors"]), 8)
371+
tr_descs = [desc["desc"] for desc in xpubs[0]["descriptors"] if desc["desc"].startswith("tr(")]
372+
assert_equal(len(tr_descs), 2)
373+
for desc in tr_descs:
374+
assert info["hdmasterfingerprint"] in desc
375+
wallet.getnewaddress(address_type="bech32m")
376+
358377
wallet.unloadwallet()
359378

360379
# Check that no automatic upgrade broke the downgrading the wallet

0 commit comments

Comments
 (0)