MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / ParseRange

Function ParseRange

src/rpc/util.cpp:1304–1316  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1302}
1303
1304static std::pair<int64_t, int64_t> ParseRange(const UniValue& value)
1305{
1306 if (value.isNum()) {
1307 return {0, value.getInt<int64_t>()};
1308 }
1309 if (value.isArray() && value.size() == 2 && value[0].isNum() && value[1].isNum()) {
1310 int64_t low = value[0].getInt<int64_t>();
1311 int64_t high = value[1].getInt<int64_t>();
1312 if (low > high) throw JSONRPCError(RPC_INVALID_PARAMETER, "Range specified as [begin,end] must not have begin after end");
1313 return {low, high};
1314 }
1315 throw JSONRPCError(RPC_INVALID_PARAMETER, "Range must be specified as end or as [begin,end]");
1316}
1317
1318std::pair<int64_t, int64_t> ParseDescriptorRange(const UniValue& value)
1319{

Callers 1

ParseDescriptorRangeFunction · 0.85

Calls 4

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

Tested by

no test coverage detected