Skip to content

Commit 81610ed

Browse files
committed
List output types in an array in order to be iterated over
1 parent eb81fc3 commit 81610ed

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/outputtype.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ static const std::string OUTPUT_TYPE_STRING_LEGACY = "legacy";
1919
static const std::string OUTPUT_TYPE_STRING_P2SH_SEGWIT = "p2sh-segwit";
2020
static const std::string OUTPUT_TYPE_STRING_BECH32 = "bech32";
2121

22+
const std::array<OutputType, 3> OUTPUT_TYPES = {OutputType::LEGACY, OutputType::P2SH_SEGWIT, OutputType::BECH32};
23+
2224
bool ParseOutputType(const std::string& type, OutputType& output_type)
2325
{
2426
if (type == OUTPUT_TYPE_STRING_LEGACY) {

src/outputtype.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include <script/signingprovider.h>
1111
#include <script/standard.h>
1212

13+
#include <array>
1314
#include <string>
1415
#include <vector>
1516

@@ -27,6 +28,8 @@ enum class OutputType {
2728
CHANGE_AUTO,
2829
};
2930

31+
extern const std::array<OutputType, 3> OUTPUT_TYPES;
32+
3033
NODISCARD bool ParseOutputType(const std::string& str, OutputType& output_type);
3134
const std::string& FormatOutputType(OutputType type);
3235

@@ -47,4 +50,3 @@ std::vector<CTxDestination> GetAllDestinationsForKey(const CPubKey& key);
4750
CTxDestination AddAndGetDestinationForScript(FillableSigningProvider& keystore, const CScript& script, OutputType);
4851

4952
#endif // BITCOIN_OUTPUTTYPE_H
50-

0 commit comments

Comments
 (0)