| 43 | } |
| 44 | |
| 45 | CTxDestination GetDestinationForKey(const CPubKey& key, OutputType type) |
| 46 | { |
| 47 | switch (type) { |
| 48 | case OutputType::LEGACY: return key.GetID(); |
| 49 | case OutputType::P2SH_SEGWIT: |
| 50 | case OutputType::BECH32: { |
| 51 | if (!key.IsCompressed()) return key.GetID(); |
| 52 | CTxDestination witdest = WitnessV0KeyHash(key.GetID()); |
| 53 | CScript witprog = GetScriptForDestination(witdest); |
| 54 | if (type == OutputType::P2SH_SEGWIT) { |
| 55 | return CScriptID(witprog); |
| 56 | } else { |
| 57 | return witdest; |
| 58 | } |
| 59 | } |
| 60 | default: assert(false); |
| 61 | } |
| 62 | } |
| 63 | |
| 64 | std::vector<CTxDestination> GetAllDestinationsForKey(const CPubKey& key) |
| 65 | { |