MCPcopy Create free account
hub / github.com/ElementsProject/elements / GetDestinationForKey

Function GetDestinationForKey

src/outputtype.cpp:50–68  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

48}
49
50CTxDestination GetDestinationForKey(const CPubKey& key, OutputType type)
51{
52 switch (type) {
53 case OutputType::LEGACY: return PKHash(key);
54 case OutputType::P2SH_SEGWIT:
55 case OutputType::BECH32: {
56 if (!key.IsCompressed()) return PKHash(key);
57 CTxDestination witdest = WitnessV0KeyHash(key);
58 CScript witprog = GetScriptForDestination(witdest);
59 if (type == OutputType::P2SH_SEGWIT) {
60 return ScriptHash(witprog);
61 } else {
62 return witdest;
63 }
64 }
65 case OutputType::BECH32M: {} // This function should never be used with BECH32M, so let it assert
66 } // no default case, so the compiler can warn about missing cases
67 assert(false);
68}
69
70std::vector<CTxDestination> GetAllDestinationsForKey(const CPubKey& key)
71{

Callers 7

GetNewDestinationMethod · 0.85
MarkUnusedAddressesMethod · 0.85
backup.cppFile · 0.85
FUZZ_TARGET_INITFunction · 0.85
TestGUIFunction · 0.85

Calls 5

PKHashClass · 0.85
WitnessV0KeyHashClass · 0.85
GetScriptForDestinationFunction · 0.85
ScriptHashClass · 0.85
IsCompressedMethod · 0.45

Tested by 3

FUZZ_TARGET_INITFunction · 0.68
TestGUIFunction · 0.68