From a712cf6f6801157667fcf36d1c498b6fff6d328a Mon Sep 17 00:00:00 2001 From: Fabian Jahr Date: Tue, 2 Jun 2020 23:52:34 +0200 Subject: rpc: gettxoutsetinfo can specify hash_type (only legacy option for now) --- src/rpc/util.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/rpc/util.cpp') diff --git a/src/rpc/util.cpp b/src/rpc/util.cpp index e7afef4cac..bac7c722c1 100644 --- a/src/rpc/util.cpp +++ b/src/rpc/util.cpp @@ -113,6 +113,21 @@ std::vector ParseHexO(const UniValue& o, std::string strKey) return ParseHexV(find_value(o, strKey), strKey); } +CoinStatsHashType ParseHashType(const UniValue& param, const CoinStatsHashType default_type) +{ + if (param.isNull()) { + return default_type; + } else { + std::string hash_type_input = param.get_str(); + + if (hash_type_input == "hash_serialized_2") { + return CoinStatsHashType::HASH_SERIALIZED; + } else { + throw JSONRPCError(RPC_INVALID_PARAMETER, strprintf("%d is not a valid hash_type", hash_type_input)); + } + } +} + std::string HelpExampleCli(const std::string& methodname, const std::string& args) { return "> bitcoin-cli " + methodname + " " + args + "\n"; -- cgit v1.2.3 From f17a4d1c4ddce6935a353004898fb4e8618a213e Mon Sep 17 00:00:00 2001 From: Fabian Jahr Date: Tue, 2 Jun 2020 23:56:28 +0200 Subject: rpc: Add hash_type NONE to gettxoutsetinfo --- src/rpc/util.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/rpc/util.cpp') diff --git a/src/rpc/util.cpp b/src/rpc/util.cpp index bac7c722c1..7abf966226 100644 --- a/src/rpc/util.cpp +++ b/src/rpc/util.cpp @@ -122,6 +122,8 @@ CoinStatsHashType ParseHashType(const UniValue& param, const CoinStatsHashType d if (hash_type_input == "hash_serialized_2") { return CoinStatsHashType::HASH_SERIALIZED; + } else if (hash_type_input == "none") { + return CoinStatsHashType::NONE; } else { throw JSONRPCError(RPC_INVALID_PARAMETER, strprintf("%d is not a valid hash_type", hash_type_input)); } -- cgit v1.2.3