From f0bb3d50fef08d9f981eac45841ef2df7444031b Mon Sep 17 00:00:00 2001 From: David Gumberg Date: Thu, 3 Jul 2025 15:29:27 -0700 Subject: [PATCH] test: Migration of a wallet ending in `/` --- test/functional/wallet_migration.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/test/functional/wallet_migration.py b/test/functional/wallet_migration.py index c00354e4d60..f8b287911b0 100755 --- a/test/functional/wallet_migration.py +++ b/test/functional/wallet_migration.py @@ -617,6 +617,26 @@ class WalletMigrationTest(BitcoinTestFramework): assert_equal(info["descriptors"], False) assert_equal(info["format"], "bdb") + def test_wallet_with_path_ending_in_slash(self): + self.log.info("Test migrating a wallet with a name/path ending in '/'") + + # The last directory in the wallet's path + final_dir = "mywallet" + wallet_name = f"path/to/{final_dir}/" + wallet = self.create_legacy_wallet(wallet_name) + default = self.master_node.get_wallet_rpc(self.default_wallet_name) + + addr = wallet.getnewaddress() + txid = default.sendtoaddress(addr, 1) + self.generate(self.master_node, 1) + bals = wallet.getbalances() + + _, wallet = self.migrate_and_get_rpc(wallet_name) + + assert wallet.gettransaction(txid) + + assert_equal(bals, wallet.getbalances()) + def test_default_wallet(self): self.log.info("Test migration of the wallet named as the empty string") wallet = self.create_legacy_wallet("") @@ -1508,6 +1528,7 @@ class WalletMigrationTest(BitcoinTestFramework): self.test_nonexistent() self.test_unloaded_by_path() self.test_wallet_with_relative_path() + self.test_wallet_with_path_ending_in_slash() self.test_default_wallet() self.test_direct_file() self.test_addressbook()