From fa58469c770d8c935a86462634e4e8cd806aa6e3 Mon Sep 17 00:00:00 2001 From: MarcoFalke Date: Sat, 30 May 2020 10:13:48 -0400 Subject: [PATCH] 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. --- src/rpc/rawtransaction.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/rpc/rawtransaction.cpp b/src/rpc/rawtransaction.cpp index a05ed86954..6e6fe0a7bf 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 ret; - for (int i = TX_NONSTANDARD; i <= TX_WITNESS_UNKNOWN; ++i) { + using U = std::underlying_type::type; + for (U i = (U)TX_NONSTANDARD; i <= (U)TX_WITNESS_UNKNOWN; ++i) { ret.emplace_back(GetTxnOutputType(static_cast(i))); } return Join(ret, ", ");