wallet: loading, log descriptor parsing error details

The `UNKNOWN_DESCRIPTOR` error comes from the
`WalletDescriptor::DeserializeDescriptor` std::ios_base
exception, which contains further information about the
parsing error.
This commit is contained in:
furszy 2023-07-10 12:20:14 -03:00
parent 79e8247ddb
commit 286e0c7d5e
No known key found for this signature in database
GPG Key ID: 5DD23CCC686AA623

View File

@ -794,11 +794,13 @@ static DBErrors LoadDescriptorWalletRecords(CWallet* pwallet, DatabaseBatch& bat
WalletDescriptor desc; WalletDescriptor desc;
try { try {
value >> desc; value >> desc;
} catch (const std::ios_base::failure&) { } catch (const std::ios_base::failure& e) {
strErr = strprintf("Error: Unrecognized descriptor found in wallet %s. ", pwallet->GetName()); strErr = strprintf("Error: Unrecognized descriptor found in wallet %s. ", pwallet->GetName());
strErr += (last_client > CLIENT_VERSION) ? "The wallet might had been created on a newer version. " : strErr += (last_client > CLIENT_VERSION) ? "The wallet might had been created on a newer version. " :
"The database might be corrupted or the software version is not compatible with one of your wallet descriptors. "; "The database might be corrupted or the software version is not compatible with one of your wallet descriptors. ";
strErr += "Please try running the latest software version"; strErr += "Please try running the latest software version";
// Also include error details
strErr = strprintf("%s\nDetails: %s", strErr, e.what());
return DBErrors::UNKNOWN_DESCRIPTOR; return DBErrors::UNKNOWN_DESCRIPTOR;
} }
pwallet->LoadDescriptorScriptPubKeyMan(id, desc); pwallet->LoadDescriptorScriptPubKeyMan(id, desc);