From f42ec0f3bfbea8c2cd0c02f4b4d64b71ded6d081 Mon Sep 17 00:00:00 2001 From: Ava Chow Date: Tue, 12 Nov 2024 21:17:59 -0500 Subject: [PATCH] wallet: Check specified wallet exists before migration The previous error message for non-existent wallets of "Already a descriptor wallet" is misleading. Return a more specific error when a non-existent wallet is specified. --- src/wallet/wallet.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 45b866d60dffe..89f273fe75641 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -4407,6 +4407,9 @@ util::Result MigrateLegacyToDescriptor(const std::string& walle if (!wallet_path) { return util::Error{util::ErrorString(wallet_path)}; } + if (!fs::exists(*wallet_path)) { + return util::Error{_("Error: Wallet does not exist")}; + } if (!IsBDBFile(BDBDataFile(*wallet_path))) { return util::Error{_("Error: This wallet is already a descriptor wallet")}; }