|
1 | 1 | // Copyright (c) 2009-2010 Satoshi Nakamoto |
2 | | -// Copyright (c) 2009-2022 The Bitcoin Core developers |
| 2 | +// Copyright (c) 2009-present The Bitcoin Core developers |
3 | 3 | // Distributed under the MIT software license, see the accompanying |
4 | 4 | // file COPYING or http://www.opensource.org/licenses/mit-license.php. |
5 | 5 |
|
|
9 | 9 | #include <script/script.h> |
10 | 10 | #include <script/sign.h> |
11 | 11 | #include <script/signingprovider.h> |
12 | | -#include <util/vector.h> |
13 | 12 |
|
14 | | -#include <assert.h> |
| 13 | +#include <cassert> |
15 | 14 | #include <optional> |
16 | 15 | #include <string> |
17 | 16 |
|
@@ -47,40 +46,6 @@ const std::string& FormatOutputType(OutputType type) |
47 | 46 | assert(false); |
48 | 47 | } |
49 | 48 |
|
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: |
66 | | - case OutputType::UNKNOWN: {} // This function should never be used with BECH32M or UNKNOWN, so let it assert |
67 | | - } // no default case, so the compiler can warn about missing cases |
68 | | - assert(false); |
69 | | -} |
70 | | - |
71 | | -std::vector<CTxDestination> GetAllDestinationsForKey(const CPubKey& key) |
72 | | -{ |
73 | | - PKHash keyid(key); |
74 | | - CTxDestination p2pkh{keyid}; |
75 | | - if (key.IsCompressed()) { |
76 | | - CTxDestination segwit = WitnessV0KeyHash(keyid); |
77 | | - CTxDestination p2sh = ScriptHash(GetScriptForDestination(segwit)); |
78 | | - return Vector(std::move(p2pkh), std::move(p2sh), std::move(segwit)); |
79 | | - } else { |
80 | | - return Vector(std::move(p2pkh)); |
81 | | - } |
82 | | -} |
83 | | - |
84 | 49 | CTxDestination AddAndGetDestinationForScript(FlatSigningProvider& keystore, const CScript& script, OutputType type) |
85 | 50 | { |
86 | 51 | // Add script to keystore |
|
0 commit comments