diff options
author | Ava Chow <github@achow101.com> | 2023-12-21 18:44:03 -0500 |
---|---|---|
committer | Ava Chow <github@achow101.com> | 2024-03-20 16:15:43 -0400 |
commit | 2402b6306215a9ee8d5f4068ea81f4e7f324adeb (patch) | |
tree | 39eaca18a074172e8978eed542e017068a4dcad7 /test/functional/wallet_backwards_compatibility.py | |
parent | 460ae1bf67c0051033c1802d44787d173abb9248 (diff) | |
download | bitcoin-2402b6306215a9ee8d5f4068ea81f4e7f324adeb.tar.xz |
wallet: Test upgrade of pre-taproot wallet to have tr() descriptors
Diffstat (limited to 'test/functional/wallet_backwards_compatibility.py')
-rwxr-xr-x | test/functional/wallet_backwards_compatibility.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/functional/wallet_backwards_compatibility.py b/test/functional/wallet_backwards_compatibility.py index 4d6e6024c5..ab008a40cd 100755 --- a/test/functional/wallet_backwards_compatibility.py +++ b/test/functional/wallet_backwards_compatibility.py @@ -355,6 +355,25 @@ class BackwardsCompatibilityTest(BitcoinTestFramework): down_wallet_name = f"re_down_{node.version}" down_backup_path = os.path.join(self.options.tmpdir, f"{down_wallet_name}.dat") wallet.backupwallet(down_backup_path) + + # 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): + 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) + assert_equal(len(xpubs[0]["descriptors"]), 6) + wallet.createwalletdescriptor("bech32m") + xpubs = wallet.gethdkeys(active_only=True) + assert_equal(len(xpubs), 1) + assert_equal(len(xpubs[0]["descriptors"]), 8) + tr_descs = [desc["desc"] for desc in xpubs[0]["descriptors"] if desc["desc"].startswith("tr(")] + assert_equal(len(tr_descs), 2) + for desc in tr_descs: + assert info["hdmasterfingerprint"] in desc + wallet.getnewaddress(address_type="bech32m") + wallet.unloadwallet() # Check that no automatic upgrade broke the downgrading the wallet |