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.
This commit is contained in:
Ava Chow 2024-11-12 21:17:59 -05:00
parent c9e67e214f
commit f42ec0f3bf

View file

@ -4407,6 +4407,9 @@ util::Result<MigrationResult> 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")};
}