Repository: bitcoin/bitcoin
File: test/functional/wallet_migration.py (Python)

Code before:
        self.assert_is_bdb("")
        backup_path = self.master_node.wallets_path / f"default_wallet_{mocked_time}.legacy.bak"
        assert backup_path.exists()

        self.clear_default_wallet(backup_path)


    def run_test(self):
        self.master_node = self.nodes[0]
        self.old_node = self.nodes[1]

        self.generate(self.master_node, 101)

        # TODO: Test the actual records in the wallet for these tests too. The behavior may be correct, but the data written may not be what we actually want
        self.test_basic()
        self.test_multisig()
        self.test_other_watchonly()
        self.test_no_privkeys()
        self.test_pk_coinbases()
        self.test_encrypted()
        self.test_nonexistent()
        self.test_unloaded_by_path()
        self.test_wallet_with_relative_path()
        self.test_wallet_with_path("path/to/mywallet/")
        self.test_wallet_with_path("path/that/ends/in/..")
        self.test_migration_failure("")
        self.test_migration_failure("../")
        self.test_migration_failure(os.path.abspath(self.master_node.datadir_path / "absolute_path"))
        self.test_default_wallet()
        self.test_default_wallet_watch_only()
        self.test_direct_file()
        self.test_addressbook()
        self.test_migrate_raw_p2sh()
        self.test_conflict_txs()
        self.test_hybrid_pubkey()
        self.test_failed_migration_cleanup()
        self.test_failed_migration_cleanup_relative_path()
        self.test_avoidreuse()
        self.test_preserve_tx_extra_info()
        self.test_blank()
        self.test_migrate_simple_watch_only()
        self.test_manual_keys_import()
        self.test_p2wsh()
        self.test_disallowed_p2wsh()
        self.test_miniscript()
        self.test_taproot()
        self.test_solvable_no_privs()
        self.test_loading_failure_after_migration()

        # Note: After this test the first 250 blocks of 'master_node' are pruned
        self.unsynced_wallet_on_pruned_node_fails()

Review comment (bug):
```suggestion
        self.test_migration_failure(wallet_name="")
```

Same for the other two.

Code after:


    def run_test(self):
        self.master_node = self.nodes[0]
        self.old_node = self.nodes[1]

        self.generate(self.master_node, 101)

        # TODO: Test the actual records in the wallet for these tests too. The behavior may be correct, but the data written may not be what we actually want
        self.test_basic()
        self.test_multisig()
        self.test_other_watchonly()
        self.test_no_privkeys()
        self.test_pk_coinbases()
        self.test_encrypted()
        self.test_nonexistent()
        self.test_unloaded_by_path()
        self.test_wallet_with_relative_path()
        self.test_wallet_with_path("path/to/mywallet/")
        self.test_wallet_with_path("path/that/ends/in/..")

        migration_failure_cases = [
            "",
            "../",
            os.path.abspath(self.master_node.datadir_path / "absolute_path"),
            "normallynamedwallet"
        ]
        for wallet_name in migration_failure_cases:
            self.test_migration_failure(wallet_name=wallet_name)

        self.test_default_wallet()
        self.test_default_wallet_watch_only()
        self.test_direct_file()
        self.test_addressbook()
        self.test_migrate_raw_p2sh()
        self.test_conflict_txs()
        self.test_hybrid_pubkey()
        self.test_failed_migration_cleanup()
        self.test_failed_migration_cleanup_relative_path()
        self.test_avoidreuse()
        self.test_preserve_tx_extra_info()
        self.test_blank()
        self.test_migrate_simple_watch_only()
        self.test_manual_keys_import()
        self.test_p2wsh()
        self.test_disallowed_p2wsh()
        self.test_miniscript()
        self.test_taproot()
        self.test_solvable_no_privs()
        self.test_loading_failure_after_migration()