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

Method GetPrivKey

src/script/descriptor.cpp:594–602  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

592 return true;
593 }
594 void GetPrivKey(int pos, const SigningProvider& arg, FlatSigningProvider& out) const override
595 {
596 CExtKey extkey;
597 CExtKey dummy;
598 if (!GetDerivedExtKey(arg, extkey, dummy)) return;
599 if (m_derive == DeriveType::UNHARDENED_RANGED && !extkey.Derive(extkey, pos)) return;
600 if (m_derive == DeriveType::HARDENED_RANGED && !extkey.Derive(extkey, pos | 0x80000000UL)) return;
601 out.keys.emplace(extkey.key.GetPubKey().GetID(), extkey.key);
602 }
603 std::optional<CPubKey> GetRootPubKey() const override
604 {
605 return std::nullopt;

Callers

nothing calls this directly

Calls 4

emplaceMethod · 0.80
DeriveMethod · 0.45
GetIDMethod · 0.45
GetPubKeyMethod · 0.45

Tested by

no test coverage detected