mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-21 07:39:08 +01:00
Merge #15744: refactor: Extract ParseDescriptorRange
510c6532baExtract ParseDescriptorRange (Ben Woosley) Pull request description: So as to be consistently informative when the checks fail, and to protect against unintentional divergence among the checks. ACKs for commit 510c65: meshcollider: Oh apologies, yes. Thanks :) utACK510c6532baMarcoFalke: utACK510c6532basipa: utACK510c6532baTree-SHA512: b1f0792bfaa163890a20654a0fc2c4c4a996659916bf5f4a495662436b39326692a1a0c825caafd859e48c05f5dd1865c4f7c28092be5074edda3c94f94f9f8b
This commit is contained in:
@@ -24,6 +24,7 @@
|
||||
#include <warnings.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <tuple>
|
||||
#ifdef HAVE_MALLOC_INFO
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
@@ -215,18 +216,7 @@ UniValue deriveaddresses(const JSONRPCRequest& request)
|
||||
int64_t range_end = 0;
|
||||
|
||||
if (request.params.size() >= 2 && !request.params[1].isNull()) {
|
||||
auto range = ParseRange(request.params[1]);
|
||||
if (range.first < 0) {
|
||||
throw JSONRPCError(RPC_INVALID_PARAMETER, "Range should be greater or equal than 0");
|
||||
}
|
||||
if ((range.second >> 31) != 0) {
|
||||
throw JSONRPCError(RPC_INVALID_PARAMETER, "End of range is too high");
|
||||
}
|
||||
if (range.second >= range.first + 1000000) {
|
||||
throw JSONRPCError(RPC_INVALID_PARAMETER, "Range is too large");
|
||||
}
|
||||
range_begin = range.first;
|
||||
range_end = range.second;
|
||||
std::tie(range_begin, range_end) = ParseDescriptorRange(request.params[1]);
|
||||
}
|
||||
|
||||
FlatSigningProvider key_provider;
|
||||
|
||||
Reference in New Issue
Block a user