Bitcoin Core  21.99.0
P2P Digital Currency
outputtype.h
Go to the documentation of this file.
1 // Copyright (c) 2009-2010 Satoshi Nakamoto
2 // Copyright (c) 2009-2020 The Bitcoin Core developers
3 // Distributed under the MIT software license, see the accompanying
4 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
5 
6 #ifndef BITCOIN_OUTPUTTYPE_H
7 #define BITCOIN_OUTPUTTYPE_H
8 
9 #include <attributes.h>
10 #include <script/signingprovider.h>
11 #include <script/standard.h>
12 
13 #include <array>
14 #include <string>
15 #include <vector>
16 
17 enum class OutputType {
18  LEGACY,
20  BECH32,
21 };
22 
23 static constexpr auto OUTPUT_TYPES = std::array{
27 };
28 
29 [[nodiscard]] bool ParseOutputType(const std::string& str, OutputType& output_type);
30 const std::string& FormatOutputType(OutputType type);
31 
37 
39 std::vector<CTxDestination> GetAllDestinationsForKey(const CPubKey& key);
40 
47 
48 #endif // BITCOIN_OUTPUTTYPE_H
OutputType
OutputType
Definition: outputtype.h:17
FormatOutputType
const std::string & FormatOutputType(OutputType type)
Definition: outputtype.cpp:37
OUTPUT_TYPES
static constexpr auto OUTPUT_TYPES
Definition: outputtype.h:23
AddAndGetDestinationForScript
CTxDestination AddAndGetDestinationForScript(FillableSigningProvider &keystore, const CScript &script, OutputType)
Get a destination of the requested type (if possible) to the specified script.
Definition: outputtype.cpp:79
OutputType::LEGACY
@ LEGACY
FillableSigningProvider
Fillable signing provider that keeps keys in an address->secret map.
Definition: signingprovider.h:63
signingprovider.h
standard.h
CScript
Serialized script, used inside transaction inputs and outputs.
Definition: script.h:404
attributes.h
OutputType::P2SH_SEGWIT
@ P2SH_SEGWIT
OutputType::BECH32
@ BECH32
GetAllDestinationsForKey
std::vector< CTxDestination > GetAllDestinationsForKey(const CPubKey &key)
Get all destinations (potentially) supported by the wallet for the given key.
Definition: outputtype.cpp:66
CPubKey
An encapsulated public key.
Definition: pubkey.h:31
ParseOutputType
bool ParseOutputType(const std::string &str, OutputType &output_type)
Definition: outputtype.cpp:22
CTxDestination
std::variant< CNoDestination, PKHash, ScriptHash, WitnessV0ScriptHash, WitnessV0KeyHash, WitnessUnknown > CTxDestination
A txout script template with a specific destination.
Definition: standard.h:212
GetDestinationForKey
CTxDestination GetDestinationForKey(const CPubKey &key, OutputType)
Get a destination of the requested type (if possible) to the specified key.
Definition: outputtype.cpp:47