MCPcopy Create free account
hub / github.com/ElementsProject/elements / MakeScripts

Method MakeScripts

src/script/descriptor.cpp:848–864  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

846 std::vector<int> m_depths;
847protected:
848 std::vector<CScript> MakeScripts(const std::vector<CPubKey>& keys, Span<const CScript> scripts, FlatSigningProvider& out) const override
849 {
850 TaprootBuilder builder;
851 assert(m_depths.size() == scripts.size());
852 for (size_t pos = 0; pos < m_depths.size(); ++pos) {
853 builder.Add(m_depths[pos], scripts[pos], TAPROOT_LEAF_TAPSCRIPT);
854 }
855 if (!builder.IsComplete()) return {};
856 assert(keys.size() == 1);
857 XOnlyPubKey xpk(keys[0]);
858 if (!xpk.IsFullyValid()) return {};
859 builder.Finalize(xpk);
860 WitnessV1Taproot output = builder.GetOutput();
861 out.tr_spenddata[output].Merge(builder.GetSpendData());
862 out.pubkeys.emplace(keys[0].GetID(), keys[0]);
863 return Vector(GetScriptForDestination(output));
864 }
865 bool ToStringSubScriptHelper(const SigningProvider* arg, std::string& ret, const StringType type, const DescriptorCache* cache = nullptr) const override
866 {
867 if (m_depths.empty()) return true;

Callers

nothing calls this directly

Calls 11

VectorFunction · 0.85
GetScriptForDestinationFunction · 0.85
IsCompleteMethod · 0.80
IsFullyValidMethod · 0.80
GetOutputMethod · 0.80
GetSpendDataMethod · 0.80
sizeMethod · 0.45
AddMethod · 0.45
FinalizeMethod · 0.45
MergeMethod · 0.45
GetIDMethod · 0.45

Tested by

no test coverage detected