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.
pull/28067/head
furszy 1 year ago
parent 79e8247ddb
commit 286e0c7d5e
No known key found for this signature in database
GPG Key ID: 5DD23CCC686AA623

@ -794,11 +794,13 @@ static DBErrors LoadDescriptorWalletRecords(CWallet* pwallet, DatabaseBatch& bat
WalletDescriptor desc;
try {
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 += (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. ";
strErr += "Please try running the latest software version";
// Also include error details
strErr = strprintf("%s\nDetails: %s", strErr, e.what());
return DBErrors::UNKNOWN_DESCRIPTOR;
}
pwallet->LoadDescriptorScriptPubKeyMan(id, desc);

Loading…
Cancel
Save