Skip to content

Commit b987e65

Browse files
author
MarcoFalke
committed
Merge #19169: rpc: Validate provided keys for query_options parameter in listunspent
a99a3c0 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 dashpay/dash#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 a99a3c0 Tree-SHA512: 9fccf14979849879a51b352afa3e1932ce4a6cfc2ee97b8d405ec6e65673fe94e302795e3ec0b440e6d252f13acda620e1f6a0e86c3fa918883c3fb4600a372c
2 parents 91af7ef + a99a3c0 commit b987e65

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/wallet/rpcwallet.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2836,6 +2836,15 @@ static UniValue listunspent(const JSONRPCRequest& request)
28362836
if (!request.params[4].isNull()) {
28372837
const UniValue& options = request.params[4].get_obj();
28382838

2839+
RPCTypeCheckObj(options,
2840+
{
2841+
{"minimumAmount", UniValueType()},
2842+
{"maximumAmount", UniValueType()},
2843+
{"minimumSumAmount", UniValueType()},
2844+
{"maximumCount", UniValueType(UniValue::VNUM)},
2845+
},
2846+
true, true);
2847+
28392848
if (options.exists("minimumAmount"))
28402849
nMinimumAmount = AmountFromValue(options["minimumAmount"]);
28412850

0 commit comments

Comments
 (0)