@@ -497,7 +497,7 @@ class DescriptorImpl : public Descriptor
497497 * @param pubkeys The evaluations of the m_pubkey_args field.
498498 * @param script The evaluation of m_subdescriptor_arg (or nullptr when m_subdescriptor_arg is nullptr).
499499 * @param out A FlatSigningProvider to put scripts or public keys in that are necessary to the solver.
500- * The script arguments to this function are automatically added, as is the origin info of the provided pubkeys.
500+ * The origin info of the provided pubkeys is automatically added .
501501 * @return A vector with scriptPubKeys for this descriptor.
502502 */
503503 virtual std::vector<CScript> MakeScripts (const std::vector<CPubKey>& pubkeys, const CScript* script, FlatSigningProvider& out) const = 0;
@@ -597,7 +597,6 @@ class DescriptorImpl : public Descriptor
597597 out.origins .emplace (entry.first .GetID (), std::make_pair<CPubKey, KeyOriginInfo>(CPubKey (entry.first ), std::move (entry.second )));
598598 }
599599 if (m_subdescriptor_arg) {
600- out.scripts .emplace (CScriptID (subscripts[0 ]), subscripts[0 ]);
601600 output_scripts = MakeScripts (pubkeys, &subscripts[0 ], out);
602601 } else {
603602 output_scripts = MakeScripts (pubkeys, nullptr , out);
@@ -776,7 +775,12 @@ class MultisigDescriptor final : public DescriptorImpl
776775class SHDescriptor final : public DescriptorImpl
777776{
778777protected:
779- std::vector<CScript> MakeScripts (const std::vector<CPubKey>&, const CScript* script, FlatSigningProvider&) const override { return Vector (GetScriptForDestination (ScriptHash (*script))); }
778+ std::vector<CScript> MakeScripts (const std::vector<CPubKey>&, const CScript* script, FlatSigningProvider& out) const override
779+ {
780+ auto ret = Vector (GetScriptForDestination (ScriptHash (*script)));
781+ if (ret.size ()) out.scripts .emplace (CScriptID (*script), *script);
782+ return ret;
783+ }
780784public:
781785 SHDescriptor (std::unique_ptr<DescriptorImpl> desc) : DescriptorImpl({}, std::move(desc), " sh" ) {}
782786
@@ -793,7 +797,12 @@ class SHDescriptor final : public DescriptorImpl
793797class WSHDescriptor final : public DescriptorImpl
794798{
795799protected:
796- std::vector<CScript> MakeScripts (const std::vector<CPubKey>&, const CScript* script, FlatSigningProvider&) const override { return Vector (GetScriptForDestination (WitnessV0ScriptHash (*script))); }
800+ std::vector<CScript> MakeScripts (const std::vector<CPubKey>&, const CScript* script, FlatSigningProvider& out) const override
801+ {
802+ auto ret = Vector (GetScriptForDestination (WitnessV0ScriptHash (*script)));
803+ if (ret.size ()) out.scripts .emplace (CScriptID (*script), *script);
804+ return ret;
805+ }
797806public:
798807 WSHDescriptor (std::unique_ptr<DescriptorImpl> desc) : DescriptorImpl({}, std::move(desc), " wsh" ) {}
799808 std::optional<OutputType> GetOutputType () const override { return OutputType::BECH32; }
0 commit comments