diff options
author | Anthony Towns <aj@erisian.com.au> | 2018-07-09 18:15:50 +1000 |
---|---|---|
committer | Anthony Towns <aj@erisian.com.au> | 2018-07-09 22:21:15 +1000 |
commit | 9a44db2e46af2b73e0dbaa929244161b18c15162 (patch) | |
tree | caff85feeaa6af556416c94af0dd10e33c19a954 /src/outputtype.h | |
parent | 88a15ebc8d317a6fd4851adb344ff944d497284c (diff) | |
download | bitcoin-9a44db2e46af2b73e0dbaa929244161b18c15162.tar.xz |
Add outputtype module
Moves OutputType into its own module
Diffstat (limited to 'src/outputtype.h')
-rw-r--r-- | src/outputtype.h | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/src/outputtype.h b/src/outputtype.h new file mode 100644 index 0000000000..0c55ac9b18 --- /dev/null +++ b/src/outputtype.h @@ -0,0 +1,41 @@ +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2017 The Bitcoin Core developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + +#ifndef BITCOIN_OUTPUTTYPE_H +#define BITCOIN_OUTPUTTYPE_H + +#include <script/standard.h> + +#include <string> +#include <vector> + +enum class OutputType { + LEGACY, + P2SH_SEGWIT, + BECH32, + + /** + * Special output type for change outputs only. Automatically choose type + * based on address type setting and the types other of non-change outputs + * (see -changetype option documentation and implementation in + * CWallet::TransactionChangeType for details). + */ + CHANGE_AUTO, +}; + +bool ParseOutputType(const std::string& str, OutputType& output_type); +const std::string& FormatOutputType(OutputType type); + +/** + * Get a destination of the requested type (if possible) to the specified key. + * The caller must make sure LearnRelatedScripts has been called beforehand. + */ +CTxDestination GetDestinationForKey(const CPubKey& key, OutputType); + +/** Get all destinations (potentially) supported by the wallet for the given key. */ +std::vector<CTxDestination> GetAllDestinationsForKey(const CPubKey& key); + +#endif // BITCOIN_OUTPUTTYPE_H + |