diff options
| author | MarcoFalke <[email protected]> | 2020-05-30 10:13:48 -0400 |
|---|---|---|
| committer | MarcoFalke <[email protected]> | 2020-06-21 06:40:26 -0400 |
| commit | fa58469c770d8c935a86462634e4e8cd806aa6e3 (patch) | |
| tree | 148684d56f7a95a997f2afcf03730a657bc86435 | |
| parent | rpc: Simplify GetAllOutputTypes with the Join helper (diff) | |
| download | discoin-fa58469c770d8c935a86462634e4e8cd806aa6e3.tar.xz discoin-fa58469c770d8c935a86462634e4e8cd806aa6e3.zip | |
rpc: Properly use underlying type in GetAllOutputTypes
Don't blindly assume it is int.
In practice this is usually `unsigned` or `int`, so this commit should
not change behavior.
| -rw-r--r-- | src/rpc/rawtransaction.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/rpc/rawtransaction.cpp b/src/rpc/rawtransaction.cpp index a05ed8695..6e6fe0a7b 100644 --- a/src/rpc/rawtransaction.cpp +++ b/src/rpc/rawtransaction.cpp @@ -512,7 +512,8 @@ static UniValue decoderawtransaction(const JSONRPCRequest& request) static std::string GetAllOutputTypes() { std::vector<std::string> ret; - for (int i = TX_NONSTANDARD; i <= TX_WITNESS_UNKNOWN; ++i) { + using U = std::underlying_type<txnouttype>::type; + for (U i = (U)TX_NONSTANDARD; i <= (U)TX_WITNESS_UNKNOWN; ++i) { ret.emplace_back(GetTxnOutputType(static_cast<txnouttype>(i))); } return Join(ret, ", "); |