diff --git a/src/wallet/rpcdump.cpp b/src/wallet/rpcdump.cpp --- a/src/wallet/rpcdump.cpp +++ b/src/wallet/rpcdump.cpp @@ -1287,14 +1287,11 @@ RPC_INVALID_PARAMETER, "Descriptor is ranged, please specify the range"); } - const UniValue &range = data["range"]; - range_start = range.exists("start") ? range["start"].get_int64() : 0; - if (!range.exists("end")) { - throw JSONRPCError(RPC_INVALID_PARAMETER, - "End of range for descriptor must be specified"); - } - range_end = range["end"].get_int64(); - if (range_end < range_start || range_start < 0) { + auto range = ParseRange(data["range"]); + range_start = range.first; + range_end = range.second; + if (range_start < 0 || (range_end >> 31) != 0 || + range_end - range_start >= 1000000) { throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid descriptor range specified"); } @@ -1589,18 +1586,11 @@ {"key", RPCArg::Type::STR, RPCArg::Optional::OMITTED, ""}, }}, - {"range", - RPCArg::Type::OBJ, + {"range", RPCArg::Type::RANGE, RPCArg::Optional::OMITTED, "If a ranged descriptor is used, this specifies the " - "start and end of the range to import", - { - {"start", RPCArg::Type::NUM, - /* default */ "0", - "Start of the range to import"}, - {"end", RPCArg::Type::NUM, RPCArg::Optional::NO, - "End of the range to import (inclusive)"}, - }}, + "end or the range (in the form [begin,end]) to " + "import"}, {"internal", RPCArg::Type::BOOL, /* default */ "false", "Stating whether matching outputs should be treated " diff --git a/test/functional/wallet_importmulti.py b/test/functional/wallet_importmulti.py --- a/test/functional/wallet_importmulti.py +++ b/test/functional/wallet_importmulti.py @@ -707,7 +707,7 @@ 'desc': descsum_create('pkh([80002067/0h/0h]' + xpub + '/*)'), 'keypool': True, 'timestamp': 'now', - 'range': {'start': 0, 'end': 4} + 'range': [0, 4], }] ) self.log.info(result)