| 1302 | } |
| 1303 | |
| 1304 | static 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 | |
| 1318 | std::pair<int64_t, int64_t> ParseDescriptorRange(const UniValue& value) |
| 1319 | { |
no test coverage detected