mirror of
https://github.com/Retropex/bitcoin.git
synced 2025-05-16 13:10:43 +02:00
List output types in an array in order to be iterated over
This commit is contained in:
parent
eb81fc3ee5
commit
81610eddbc
@ -19,6 +19,8 @@ static const std::string OUTPUT_TYPE_STRING_LEGACY = "legacy";
|
|||||||
static const std::string OUTPUT_TYPE_STRING_P2SH_SEGWIT = "p2sh-segwit";
|
static const std::string OUTPUT_TYPE_STRING_P2SH_SEGWIT = "p2sh-segwit";
|
||||||
static const std::string OUTPUT_TYPE_STRING_BECH32 = "bech32";
|
static const std::string OUTPUT_TYPE_STRING_BECH32 = "bech32";
|
||||||
|
|
||||||
|
const std::array<OutputType, 3> OUTPUT_TYPES = {OutputType::LEGACY, OutputType::P2SH_SEGWIT, OutputType::BECH32};
|
||||||
|
|
||||||
bool ParseOutputType(const std::string& type, OutputType& output_type)
|
bool ParseOutputType(const std::string& type, OutputType& output_type)
|
||||||
{
|
{
|
||||||
if (type == OUTPUT_TYPE_STRING_LEGACY) {
|
if (type == OUTPUT_TYPE_STRING_LEGACY) {
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
#include <script/signingprovider.h>
|
#include <script/signingprovider.h>
|
||||||
#include <script/standard.h>
|
#include <script/standard.h>
|
||||||
|
|
||||||
|
#include <array>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
@ -27,6 +28,8 @@ enum class OutputType {
|
|||||||
CHANGE_AUTO,
|
CHANGE_AUTO,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
extern const std::array<OutputType, 3> OUTPUT_TYPES;
|
||||||
|
|
||||||
NODISCARD bool ParseOutputType(const std::string& str, OutputType& output_type);
|
NODISCARD bool ParseOutputType(const std::string& str, OutputType& output_type);
|
||||||
const std::string& FormatOutputType(OutputType type);
|
const std::string& FormatOutputType(OutputType type);
|
||||||
|
|
||||||
@ -47,4 +50,3 @@ std::vector<CTxDestination> GetAllDestinationsForKey(const CPubKey& key);
|
|||||||
CTxDestination AddAndGetDestinationForScript(FillableSigningProvider& keystore, const CScript& script, OutputType);
|
CTxDestination AddAndGetDestinationForScript(FillableSigningProvider& keystore, const CScript& script, OutputType);
|
||||||
|
|
||||||
#endif // BITCOIN_OUTPUTTYPE_H
|
#endif // BITCOIN_OUTPUTTYPE_H
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user