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

Method ExpandHelper

src/script/descriptor.cpp:995–1018  ·  view source on GitHub ↗

NOLINTNEXTLINE(misc-no-recursion)

Source from the content-addressed store, hash-verified

993
994 // NOLINTNEXTLINE(misc-no-recursion)
995 bool ExpandHelper(int pos, const SigningProvider& arg, const DescriptorCache* read_cache, std::vector<CScript>& output_scripts, FlatSigningProvider& out, DescriptorCache* write_cache) const
996 {
997 FlatSigningProvider subprovider;
998 std::vector<CPubKey> pubkeys;
999 pubkeys.reserve(m_pubkey_args.size());
1000
1001 // Construct temporary data in `pubkeys`, `subscripts`, and `subprovider` to avoid producing output in case of failure.
1002 for (const auto& p : m_pubkey_args) {
1003 std::optional<CPubKey> pubkey = p->GetPubKey(pos, arg, subprovider, read_cache, write_cache);
1004 if (!pubkey) return false;
1005 pubkeys.push_back(pubkey.value());
1006 }
1007 std::vector<CScript> subscripts;
1008 for (const auto& subarg : m_subdescriptor_args) {
1009 std::vector<CScript> outscripts;
1010 if (!subarg->ExpandHelper(pos, arg, read_cache, outscripts, subprovider, write_cache)) return false;
1011 assert(outscripts.size() == 1);
1012 subscripts.emplace_back(std::move(outscripts[0]));
1013 }
1014 out.Merge(std::move(subprovider));
1015
1016 output_scripts = MakeScripts(pubkeys, std::span{subscripts}, out);
1017 return true;
1018 }
1019
1020 bool Expand(int pos, const SigningProvider& provider, std::vector<CScript>& output_scripts, FlatSigningProvider& out, DescriptorCache* write_cache = nullptr) const final
1021 {

Callers

nothing calls this directly

Calls 7

reserveMethod · 0.45
sizeMethod · 0.45
GetPubKeyMethod · 0.45
push_backMethod · 0.45
valueMethod · 0.45
emplace_backMethod · 0.45
MergeMethod · 0.45

Tested by

no test coverage detected