MCPcopy Create free account
hub / github.com/BTCGPU/BTCGPU / GetKeyForDestination

Function GetKeyForDestination

src/keystore.cpp:177–197  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

175}
176
177CKeyID GetKeyForDestination(const CKeyStore& store, const CTxDestination& dest)
178{
179 // Only supports destinations which map to single public keys, i.e. P2PKH,
180 // P2WPKH, and P2SH-P2WPKH.
181 if (auto id = boost::get<CKeyID>(&dest)) {
182 return *id;
183 }
184 if (auto witness_id = boost::get<WitnessV0KeyHash>(&dest)) {
185 return CKeyID(*witness_id);
186 }
187 if (auto script_id = boost::get<CScriptID>(&dest)) {
188 CScript script;
189 CTxDestination inner_dest;
190 if (store.GetCScript(*script_id, script) && ExtractDestination(script, inner_dest)) {
191 if (auto inner_witness_id = boost::get<WitnessV0KeyHash>(&inner_dest)) {
192 return CKeyID(*inner_witness_id);
193 }
194 }
195 }
196 return CKeyID();
197}
198
199bool HaveKey(const CKeyStore& store, const CKey& key)
200{

Callers 3

getaddressinfoFunction · 0.85
dumpprivkeyFunction · 0.85
AddrToPubKeyFunction · 0.85

Calls 3

ExtractDestinationFunction · 0.85
CKeyIDClass · 0.70
GetCScriptMethod · 0.45

Tested by

no test coverage detected