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.
pull/764/head
MarcoFalke 5 years ago
parent fa41c65702
commit fa58469c77
No known key found for this signature in database
GPG Key ID: CE2B75697E69A548

@ -512,7 +512,8 @@ static UniValue decoderawtransaction(const JSONRPCRequest& request)
static std::string GetAllOutputTypes() static std::string GetAllOutputTypes()
{ {
std::vector<std::string> ret; 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))); ret.emplace_back(GetTxnOutputType(static_cast<txnouttype>(i)));
} }
return Join(ret, ", "); return Join(ret, ", ");

Loading…
Cancel
Save