From cbf0bd35bbf312f3b13d92d281d7112e4b43b9c3 Mon Sep 17 00:00:00 2001 From: furszy Date: Wed, 7 Jan 2026 16:29:30 -0500 Subject: [PATCH] test: migration, avoid backup name mismatch in default_wallet_failure The test calls migrate_and_get_rpc(), which sets mock time internally. The caller caches a mock time value and later relies on it to predict the backup filename, so setting the mock time again could cause a naming mismatch. Fix this by calling the migration RPC directly. Since the test expects the migration to fail, migrate_and_get_rpc() is unnecessary here. --- test/functional/wallet_migration.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/functional/wallet_migration.py b/test/functional/wallet_migration.py index e90c48fa6b0..c6eed10d8c7 100755 --- a/test/functional/wallet_migration.py +++ b/test/functional/wallet_migration.py @@ -711,6 +711,7 @@ class WalletMigrationTest(BitcoinTestFramework): master_wallet = self.master_node.get_wallet_rpc(self.default_wallet_name) wallet = self.create_legacy_wallet("", blank=True) wallet.importaddress(master_wallet.getnewaddress(address_type="legacy")) + wallet.unloadwallet() # Create wallet directory with the watch-only name and a wallet file. # Because the wallet dir exists, this will cause migration to fail. @@ -720,7 +721,8 @@ class WalletMigrationTest(BitcoinTestFramework): mocked_time = int(time.time()) self.master_node.setmocktime(mocked_time) - assert_raises_rpc_error(-4, "Failed to create database", self.migrate_and_get_rpc, "") + shutil.copyfile(self.old_node.wallets_path / "wallet.dat", self.master_node.wallets_path / "wallet.dat") + assert_raises_rpc_error(-4, "Failed to create database", self.master_node.migratewallet, wallet_name="") self.master_node.setmocktime(0) # Verify the /wallets/ path exists