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

Method GetPubKey

src/script/descriptor.cpp:270–280  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

268public:
269 OriginPubkeyProvider(uint32_t exp_index, KeyOriginInfo info, std::unique_ptr<PubkeyProvider> provider, bool apostrophe) : PubkeyProvider(exp_index), m_origin(std::move(info)), m_provider(std::move(provider)), m_apostrophe(apostrophe) {}
270 std::optional<CPubKey> GetPubKey(int pos, const SigningProvider& arg, FlatSigningProvider& out, const DescriptorCache* read_cache = nullptr, DescriptorCache* write_cache = nullptr) const override
271 {
272 std::optional<CPubKey> pub = m_provider->GetPubKey(pos, arg, out, read_cache, write_cache);
273 if (!pub) return std::nullopt;
274 Assert(out.pubkeys.contains(pub->GetID()));
275 auto& [pubkey, suborigin] = out.origins[pub->GetID()];
276 Assert(pubkey == *pub); // m_provider must have a valid origin by this point.
277 std::copy(std::begin(m_origin.fingerprint), std::end(m_origin.fingerprint), suborigin.fingerprint);
278 suborigin.path.insert(suborigin.path.begin(), m_origin.path.begin(), m_origin.path.end());
279 return pub;
280 }
281 bool IsRange() const override { return m_provider->IsRange(); }
282 size_t GetSize() const override { return m_provider->GetSize(); }
283 bool IsBIP32() const override { return m_provider->IsBIP32(); }

Callers

nothing calls this directly

Calls 8

beginFunction · 0.85
endFunction · 0.85
GetPubKeyMethod · 0.45
containsMethod · 0.45
GetIDMethod · 0.45
insertMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected