mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-19 14:53:43 +01:00
It is only used in test. There it is problematic, because it sometimes
relies on m_default_address_type. If the default were changed to
BECH32M, those tests would fail the assert(false).
So just use PKHash{} in all tests and remove GetDestinationForKey.
46 lines
1.2 KiB
C++
46 lines
1.2 KiB
C++
// Copyright (c) 2009-2010 Satoshi Nakamoto
|
|
// Copyright (c) 2009-present 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 <addresstype.h>
|
|
#include <script/signingprovider.h>
|
|
|
|
#include <array>
|
|
#include <optional>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
enum class OutputType {
|
|
LEGACY,
|
|
P2SH_SEGWIT,
|
|
BECH32,
|
|
BECH32M,
|
|
UNKNOWN,
|
|
};
|
|
|
|
static constexpr auto OUTPUT_TYPES = std::array{
|
|
OutputType::LEGACY,
|
|
OutputType::P2SH_SEGWIT,
|
|
OutputType::BECH32,
|
|
OutputType::BECH32M,
|
|
};
|
|
|
|
std::optional<OutputType> ParseOutputType(const std::string& str);
|
|
const std::string& FormatOutputType(OutputType type);
|
|
|
|
/**
|
|
* Get a destination of the requested type (if possible) to the specified script.
|
|
* This function will automatically add the script (and any other
|
|
* necessary scripts) to the keystore.
|
|
*/
|
|
CTxDestination AddAndGetDestinationForScript(FlatSigningProvider& keystore, const CScript& script, OutputType);
|
|
|
|
/** Get the OutputType for a CTxDestination */
|
|
std::optional<OutputType> OutputTypeFromDestination(const CTxDestination& dest);
|
|
|
|
#endif // BITCOIN_OUTPUTTYPE_H
|