| 48 | } |
| 49 | |
| 50 | CTxDestination 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 | |
| 70 | std::vector<CTxDestination> GetAllDestinationsForKey(const CPubKey& key) |
| 71 | { |