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 committed 2023-07-11 11:34:25 -03:00
1 parent 79e8247ddb
commit 286e0c7d5e
1 file changed
+3 -1
+3 -1
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);