Check descriptors returned by external signers

Check that descriptors returned by external signers have been parsed properly when creating a new wallet.
This commit is contained in:
sstone
2021-11-29 15:48:36 +01:00
parent b4f647fa36
commit 5493e92501
3 changed files with 87 additions and 2 deletions

View File

@ -3203,8 +3203,11 @@ void CWallet::SetupDescriptorScriptPubKeyMans()
for (const UniValue& desc_val : descriptor_vals.get_array().getValues()) {
std::string desc_str = desc_val.getValStr();
FlatSigningProvider keys;
std::string dummy_error;
std::unique_ptr<Descriptor> desc = Parse(desc_str, keys, dummy_error, false);
std::string desc_error;
std::unique_ptr<Descriptor> desc = Parse(desc_str, keys, desc_error, false);
if (desc == nullptr) {
throw std::runtime_error(std::string(__func__) + ": Invalid descriptor \"" + desc_str + "\" (" + desc_error + ")");
}
if (!desc->GetOutputType()) {
continue;
}