Skip to content

Commit fa58469

Browse files
author
MarcoFalke
committed
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.
1 parent fa41c65 commit fa58469

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/rpc/rawtransaction.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,8 @@ static UniValue decoderawtransaction(const JSONRPCRequest& request)
512512
static std::string GetAllOutputTypes()
513513
{
514514
std::vector<std::string> ret;
515-
for (int i = TX_NONSTANDARD; i <= TX_WITNESS_UNKNOWN; ++i) {
515+
using U = std::underlying_type<txnouttype>::type;
516+
for (U i = (U)TX_NONSTANDARD; i <= (U)TX_WITNESS_UNKNOWN; ++i) {
516517
ret.emplace_back(GetTxnOutputType(static_cast<txnouttype>(i)));
517518
}
518519
return Join(ret, ", ");

0 commit comments

Comments
 (0)