mirror of
https://github.com/Retropex/bitcoin.git
synced 2025-06-02 15:32:34 +02:00
Remove support for subdescriptors expanding to multiple scripts
This commit is contained in:
parent
1c7be9ab90
commit
84f3939ece
@ -484,6 +484,7 @@ protected:
|
|||||||
//! The sub-descriptor argument (nullptr for everything but SH and WSH).
|
//! The sub-descriptor argument (nullptr for everything but SH and WSH).
|
||||||
//! In doc/descriptors.m this is referred to as SCRIPT expressions sh(SCRIPT)
|
//! In doc/descriptors.m this is referred to as SCRIPT expressions sh(SCRIPT)
|
||||||
//! and wsh(SCRIPT), and distinct from KEY expressions and ADDR expressions.
|
//! and wsh(SCRIPT), and distinct from KEY expressions and ADDR expressions.
|
||||||
|
//! Subdescriptors can only ever generate a single script.
|
||||||
const std::unique_ptr<DescriptorImpl> m_subdescriptor_arg;
|
const std::unique_ptr<DescriptorImpl> m_subdescriptor_arg;
|
||||||
|
|
||||||
//! Return a serialization of anything except pubkey and script arguments, to be prepended to those.
|
//! Return a serialization of anything except pubkey and script arguments, to be prepended to those.
|
||||||
@ -491,8 +492,7 @@ protected:
|
|||||||
|
|
||||||
/** A helper function to construct the scripts for this descriptor.
|
/** A helper function to construct the scripts for this descriptor.
|
||||||
*
|
*
|
||||||
* This function is invoked once for every CScript produced by evaluating
|
* This function is invoked once by ExpandHelper.
|
||||||
* m_subdescriptor_arg, or just once in case m_subdescriptor_arg is nullptr.
|
|
||||||
|
|
||||||
* @param pubkeys The evaluations of the m_pubkey_args field.
|
* @param pubkeys The evaluations of the m_pubkey_args field.
|
||||||
* @param script The evaluation of m_subdescriptor_arg (or nullptr when m_subdescriptor_arg is nullptr).
|
* @param script The evaluation of m_subdescriptor_arg (or nullptr when m_subdescriptor_arg is nullptr).
|
||||||
@ -586,6 +586,7 @@ public:
|
|||||||
if (m_subdescriptor_arg) {
|
if (m_subdescriptor_arg) {
|
||||||
FlatSigningProvider subprovider;
|
FlatSigningProvider subprovider;
|
||||||
if (!m_subdescriptor_arg->ExpandHelper(pos, arg, read_cache, subscripts, subprovider, write_cache)) return false;
|
if (!m_subdescriptor_arg->ExpandHelper(pos, arg, read_cache, subscripts, subprovider, write_cache)) return false;
|
||||||
|
assert(subscripts.size() == 1);
|
||||||
out = Merge(out, subprovider);
|
out = Merge(out, subprovider);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -596,13 +597,8 @@ public:
|
|||||||
out.origins.emplace(entry.first.GetID(), std::make_pair<CPubKey, KeyOriginInfo>(CPubKey(entry.first), std::move(entry.second)));
|
out.origins.emplace(entry.first.GetID(), std::make_pair<CPubKey, KeyOriginInfo>(CPubKey(entry.first), std::move(entry.second)));
|
||||||
}
|
}
|
||||||
if (m_subdescriptor_arg) {
|
if (m_subdescriptor_arg) {
|
||||||
for (const auto& subscript : subscripts) {
|
out.scripts.emplace(CScriptID(subscripts[0]), subscripts[0]);
|
||||||
out.scripts.emplace(CScriptID(subscript), subscript);
|
output_scripts = MakeScripts(pubkeys, &subscripts[0], out);
|
||||||
std::vector<CScript> addscripts = MakeScripts(pubkeys, &subscript, out);
|
|
||||||
for (auto& addscript : addscripts) {
|
|
||||||
output_scripts.push_back(std::move(addscript));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
output_scripts = MakeScripts(pubkeys, nullptr, out);
|
output_scripts = MakeScripts(pubkeys, nullptr, out);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user