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.
This commit is contained in:
MarcoFalke 2020-05-30 10:13:48 -04:00
parent fa41c65702
commit fa58469c77
No known key found for this signature in database
GPG key ID: CE2B75697E69A548

View file

@ -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, ", ");