MCPcopy Create free account
hub / github.com/ElementsProject/elements / ParseRange

Function ParseRange

src/rpc/util.cpp:998–1010  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

996}
997
998static std::pair<int64_t, int64_t> ParseRange(const UniValue& value)
999{
1000 if (value.isNum()) {
1001 return {0, value.get_int64()};
1002 }
1003 if (value.isArray() && value.size() == 2 && value[0].isNum() && value[1].isNum()) {
1004 int64_t low = value[0].get_int64();
1005 int64_t high = value[1].get_int64();
1006 if (low > high) throw JSONRPCError(RPC_INVALID_PARAMETER, "Range specified as [begin,end] must not have begin after end");
1007 return {low, high};
1008 }
1009 throw JSONRPCError(RPC_INVALID_PARAMETER, "Range must be specified as end or as [begin,end]");
1010}
1011
1012std::pair<int64_t, int64_t> ParseDescriptorRange(const UniValue& value)
1013{

Callers 1

ParseDescriptorRangeFunction · 0.85

Calls 5

JSONRPCErrorFunction · 0.85
isNumMethod · 0.80
get_int64Method · 0.80
isArrayMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected