@@ -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