MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / MakeScripts

Method MakeScripts

src/script/descriptor.cpp:1370–1382  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1368protected:
1369 std::string ToStringExtra() const override { return strprintf("%i", m_threshold); }
1370 std::vector<CScript> MakeScripts(const std::vector<CPubKey>& keys, std::span<const CScript>, FlatSigningProvider&) const override {
1371 CScript ret;
1372 std::vector<XOnlyPubKey> xkeys;
1373 xkeys.reserve(keys.size());
1374 for (const auto& key : keys) xkeys.emplace_back(key);
1375 if (m_sorted) std::sort(xkeys.begin(), xkeys.end());
1376 ret << ToByteVector(xkeys[0]) << OP_CHECKSIG;
1377 for (size_t i = 1; i < keys.size(); ++i) {
1378 ret << ToByteVector(xkeys[i]) << OP_CHECKSIGADD;
1379 }
1380 ret << m_threshold << OP_NUMEQUAL;
1381 return Vector(std::move(ret));
1382 }
1383public:
1384 MultiADescriptor(int threshold, std::vector<std::unique_ptr<PubkeyProvider>> providers, bool sorted = false) : DescriptorImpl(std::move(providers), sorted ? "sortedmulti_a" : "multi_a"), m_threshold(threshold), m_sorted(sorted) {}
1385 bool IsSingleType() const final { return true; }

Callers

nothing calls this directly

Calls 7

ToByteVectorFunction · 0.85
VectorFunction · 0.85
reserveMethod · 0.45
sizeMethod · 0.45
emplace_backMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected