mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-22 15:04:44 +01:00
wallet: Better error message when missing LegacySPKM during migration
This commit is contained in:
parent
b1d2c771d4
commit
563b2a60d6
1 changed files with 8 additions and 3 deletions
|
@ -3862,7 +3862,11 @@ std::optional<MigrationData> CWallet::GetDescriptorsForLegacy(bilingual_str& err
|
|||
AssertLockHeld(cs_wallet);
|
||||
|
||||
LegacyScriptPubKeyMan* legacy_spkm = GetLegacyScriptPubKeyMan();
|
||||
assert(legacy_spkm);
|
||||
if (!Assume(legacy_spkm)) {
|
||||
// This shouldn't happen
|
||||
error = Untranslated(STR_INTERNAL_BUG("Error: Legacy wallet data missing"));
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
std::optional<MigrationData> res = legacy_spkm->MigrateToDescriptor();
|
||||
if (res == std::nullopt) {
|
||||
|
@ -3877,8 +3881,9 @@ bool CWallet::ApplyMigrationData(MigrationData& data, bilingual_str& error)
|
|||
AssertLockHeld(cs_wallet);
|
||||
|
||||
LegacyScriptPubKeyMan* legacy_spkm = GetLegacyScriptPubKeyMan();
|
||||
if (!legacy_spkm) {
|
||||
error = _("Error: This wallet is already a descriptor wallet");
|
||||
if (!Assume(legacy_spkm)) {
|
||||
// This shouldn't happen
|
||||
error = Untranslated(STR_INTERNAL_BUG("Error: Legacy wallet data missing"));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue