0
0
Fork 0
mirror of https://github.com/bitcoin/bitcoin.git synced 2025-02-02 09:46:52 -05:00

wallet: Skip key and script migration for blank wallets

Blank wallets don't have any keys or scripts to migrate
This commit is contained in:
Andrew Chow 2023-11-30 16:00:02 -05:00 committed by Ava Chow
parent 4baa162dbb
commit 8c127ff1ed

View file

@ -4246,8 +4246,11 @@ util::Result<MigrationResult> MigrateLegacyToDescriptor(const std::string& walle
// First change to using SQLite
if (!local_wallet->MigrateToSQLite(error)) return util::Error{error};
// Do the migration, and cleanup if it fails
success = DoMigration(*local_wallet, context, error, res);
// Do the migration of keys and scripts for non-blank wallets, and cleanup if it fails
success = local_wallet->IsWalletFlagSet(WALLET_FLAG_BLANK_WALLET);
if (!success) {
success = DoMigration(*local_wallet, context, error, res);
}
}
// In case of reloading failure, we need to remember the wallet dirs to remove