aboutsummaryrefslogtreecommitdiff
path: root/src/wallet
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2020-08-27 20:17:22 +0200
committerMarcoFalke <falke.marco@gmail.com>2020-08-27 20:17:25 +0200
commitb987e657cda982a65c181e378ab9a9f3ca765b49 (patch)
treea4268e1ee6de5e6cd84bae0698aadaa7e5e650a2 /src/wallet
parent91af7ef831d32a9db7719c64442a7d76cef5a931 (diff)
parenta99a3c0bd6d5476503c015e23be569295fdd190c (diff)
downloadbitcoin-b987e657cda982a65c181e378ab9a9f3ca765b49.tar.xz
Merge #19169: rpc: Validate provided keys for query_options parameter in listunspent
a99a3c0bd6d5476503c015e23be569295fdd190c rpc: Validate provided keys for query_options parameter in listunspent (pasta) Pull request description: At Dash, one of our developers was working with the `listunspent` RPC command, but instead of saying "minimumAmount" he said "minimmumAmount" as such the RPC wasn't working as expected. In https://github.com/dashpay/dash/pull/3507 we implemented a check so that `listunspent` returns an error if an unrecognized option is given. I figured I might as well adapt the code and throw up a PR here. Cheers! ACKs for top commit: adaminsky: ACK `a99a3c0bd` meshcollider: Seems fine to me. utACK a99a3c0bd6d5476503c015e23be569295fdd190c Tree-SHA512: 9fccf14979849879a51b352afa3e1932ce4a6cfc2ee97b8d405ec6e65673fe94e302795e3ec0b440e6d252f13acda620e1f6a0e86c3fa918883c3fb4600a372c
Diffstat (limited to 'src/wallet')
-rw-r--r--src/wallet/rpcwallet.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp
index 7a03c4f544..17512265b5 100644
--- a/src/wallet/rpcwallet.cpp
+++ b/src/wallet/rpcwallet.cpp
@@ -2836,6 +2836,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"]);