descriptors: Change Parse to return vector of descriptors

When given a descriptor which contins a multipath derivation specifier,
a vector of descriptors will be returned.
This commit is contained in:
Ava Chow
2024-08-07 16:29:06 -04:00
parent 0d640c6f02
commit 1bbf46e2da
22 changed files with 178 additions and 111 deletions

View File

@@ -660,11 +660,13 @@ CreatedTransactionResult FundTransaction(CWallet& wallet, const CMutableTransact
FlatSigningProvider desc_out;
std::string error;
std::vector<CScript> scripts_temp;
std::unique_ptr<Descriptor> desc = Parse(desc_str, desc_out, error, true);
if (!desc) {
auto descs = Parse(desc_str, desc_out, error, true);
if (descs.empty()) {
throw JSONRPCError(RPC_INVALID_PARAMETER, strprintf("Unable to parse descriptor '%s': %s", desc_str, error));
}
desc->Expand(0, desc_out, scripts_temp, desc_out);
for (auto& desc : descs) {
desc->Expand(0, desc_out, scripts_temp, desc_out);
}
coinControl.m_external_provider.Merge(std::move(desc_out));
}
}