diff options
| author | pasta <[email protected]> | 2020-06-05 13:40:02 -0500 |
|---|---|---|
| committer | pasta <[email protected]> | 2020-06-05 15:01:26 -0500 |
| commit | a99a3c0bd6d5476503c015e23be569295fdd190c (patch) | |
| tree | ead09fe9fa1e24c6cf9e2fa3c0413c4c8e895237 /src/wallet | |
| parent | Merge #19053: refactor: replace CNode pointers by references within net_proce... (diff) | |
| download | discoin-a99a3c0bd6d5476503c015e23be569295fdd190c.tar.xz discoin-a99a3c0bd6d5476503c015e23be569295fdd190c.zip | |
rpc: Validate provided keys for query_options parameter in listunspent
With this change listunspent will throw an error if there is a wrong key
in the query_option object.
Signed-off-by: pasta <[email protected]>
Diffstat (limited to 'src/wallet')
| -rw-r--r-- | src/wallet/rpcwallet.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 2a9ac189e..2dbe88ad1 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -2898,6 +2898,15 @@ static UniValue listunspent(const JSONRPCRequest& request) if (!request.params[4].isNull()) { const UniValue& options = request.params[4].get_obj(); + RPCTypeCheckObj(options, + { + {"minimumAmount", UniValueType()}, + {"maximumAmount", UniValueType()}, + {"minimumSumAmount", UniValueType()}, + {"maximumCount", UniValueType(UniValue::VNUM)}, + }, + true, true); + if (options.exists("minimumAmount")) nMinimumAmount = AmountFromValue(options["minimumAmount"]); |