wallet: Set migrated wallet name only on success

After a wallet is migrated and we are trying to load it, if it could not be
loaded, don't try to set the wallet name.
This commit is contained in:
Ava Chow
2025-07-15 16:11:36 -07:00
parent 184159e4f3
commit 8a4cfddf23

View File

@@ -4306,7 +4306,7 @@ util::Result<MigrationResult> MigrateLegacyToDescriptor(std::shared_ptr<CWallet>
success = (wallet != nullptr);
// When no wallet is set, set the main wallet.
if (!res.wallet) {
if (success && !res.wallet) {
res.wallet_name = wallet->GetName();
res.wallet = std::move(wallet);
}