diff options
author | Ben Woosley <ben.woosley@gmail.com> | 2019-04-04 00:39:04 -0700 |
---|---|---|
committer | Ben Woosley <ben.woosley@gmail.com> | 2019-04-13 18:52:11 -0700 |
commit | 510c6532bae9abc5beda1c126c945923a64680cb (patch) | |
tree | 08817bc88ad774370833066ca14714a6f8a2d262 /src/wallet | |
parent | ba54342c9dd3f2e5cdeed9ac57f1924f0d885cc6 (diff) |
Extract ParseDescriptorRange
So as to be consistently informative when the checks fail, and
to protect against unintentional divergence among the checks.
Diffstat (limited to 'src/wallet')
-rw-r--r-- | src/wallet/rpcdump.cpp | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/src/wallet/rpcdump.cpp b/src/wallet/rpcdump.cpp index 9c5dae3623..674b56fe9d 100644 --- a/src/wallet/rpcdump.cpp +++ b/src/wallet/rpcdump.cpp @@ -22,6 +22,7 @@ #include <wallet/rpcwallet.h> #include <stdint.h> +#include <tuple> #include <boost/algorithm/string.hpp> #include <boost/date_time/posix_time/posix_time.hpp> @@ -1144,12 +1145,7 @@ static UniValue ProcessImportDescriptor(ImportData& import_data, std::map<CKeyID if (!data.exists("range")) { throw JSONRPCError(RPC_INVALID_PARAMETER, "Descriptor is ranged, please specify the range"); } - 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"); - } + std::tie(range_start, range_end) = ParseDescriptorRange(data["range"]); } const UniValue& priv_keys = data.exists("keys") ? data["keys"].get_array() : UniValue(); |