aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/wallet.cpp
diff options
context:
space:
mode:
authorsstone <fabrice.drouin@acinq.fr>2021-11-29 15:48:36 +0100
committersstone <fabrice.drouin@acinq.fr>2021-12-09 11:17:04 +0100
commit5493e925013245d5ad0f7ea8784fe07f531803d0 (patch)
tree20ee6a5da53efaa594278e4a91884f3953b07336 /src/wallet/wallet.cpp
parentb4f647fa36a3336774ab616048bc6709bdc59fa1 (diff)
Check descriptors returned by external signers
Check that descriptors returned by external signers have been parsed properly when creating a new wallet.
Diffstat (limited to 'src/wallet/wallet.cpp')
-rw-r--r--src/wallet/wallet.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp
index 2382ac268d..64a4844dc9 100644
--- a/src/wallet/wallet.cpp
+++ b/src/wallet/wallet.cpp
@@ -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;
}