diff options
author | Fabian Jahr <fjahr@protonmail.com> | 2020-06-02 23:52:34 +0200 |
---|---|---|
committer | Fabian Jahr <fjahr@protonmail.com> | 2020-06-22 00:55:44 +0200 |
commit | a712cf6f6801157667fcf36d1c498b6fff6d328a (patch) | |
tree | 1ac2dbe3f86e8d04b271fa0c187f522cf963c110 /src/rpc/util.cpp | |
parent | 605884ef21318fc3f326dbdf4901cb353ba63fab (diff) |
rpc: gettxoutsetinfo can specify hash_type (only legacy option for now)
Diffstat (limited to 'src/rpc/util.cpp')
-rw-r--r-- | src/rpc/util.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
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<unsigned char> 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"; |