@@ -497,7 +497,7 @@ class DescriptorImpl : public Descriptor
497
497
* @param pubkeys The evaluations of the m_pubkey_args field.
498
498
* @param script The evaluation of m_subdescriptor_arg (or nullptr when m_subdescriptor_arg is nullptr).
499
499
* @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 .
501
501
* @return A vector with scriptPubKeys for this descriptor.
502
502
*/
503
503
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
597
597
out.origins .emplace (entry.first .GetID (), std::make_pair<CPubKey, KeyOriginInfo>(CPubKey (entry.first ), std::move (entry.second )));
598
598
}
599
599
if (m_subdescriptor_arg) {
600
- out.scripts .emplace (CScriptID (subscripts[0 ]), subscripts[0 ]);
601
600
output_scripts = MakeScripts (pubkeys, &subscripts[0 ], out);
602
601
} else {
603
602
output_scripts = MakeScripts (pubkeys, nullptr , out);
@@ -776,7 +775,12 @@ class MultisigDescriptor final : public DescriptorImpl
776
775
class SHDescriptor final : public DescriptorImpl
777
776
{
778
777
protected:
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
+ }
780
784
public:
781
785
SHDescriptor (std::unique_ptr<DescriptorImpl> desc) : DescriptorImpl({}, std::move(desc), " sh" ) {}
782
786
@@ -793,7 +797,12 @@ class SHDescriptor final : public DescriptorImpl
793
797
class WSHDescriptor final : public DescriptorImpl
794
798
{
795
799
protected:
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
+ }
797
806
public:
798
807
WSHDescriptor (std::unique_ptr<DescriptorImpl> desc) : DescriptorImpl({}, std::move(desc), " wsh" ) {}
799
808
std::optional<OutputType> GetOutputType () const override { return OutputType::BECH32; }
0 commit comments