From 8c127ff1edb6b9a607bf1ad247893347252a38e3 Mon Sep 17 00:00:00 2001 From: Andrew Chow Date: Thu, 30 Nov 2023 16:00:02 -0500 Subject: [PATCH] wallet: Skip key and script migration for blank wallets Blank wallets don't have any keys or scripts to migrate --- src/wallet/wallet.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index bf8cfcb082..3cf4e9bdd1 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -4246,8 +4246,11 @@ util::Result 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