Skip to content

Commit a99a3c0

Browse files
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]>
1 parent 01b45b2 commit a99a3c0

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
@@ -2898,6 +2898,15 @@ static UniValue listunspent(const JSONRPCRequest& request)
28982898
if (!request.params[4].isNull()) {
28992899
const UniValue& options = request.params[4].get_obj();
29002900

2901+
RPCTypeCheckObj(options,
2902+
{
2903+
{"minimumAmount", UniValueType()},
2904+
{"maximumAmount", UniValueType()},
2905+
{"minimumSumAmount", UniValueType()},
2906+
{"maximumCount", UniValueType(UniValue::VNUM)},
2907+
},
2908+
true, true);
2909+
29012910
if (options.exists("minimumAmount"))
29022911
nMinimumAmount = AmountFromValue(options["minimumAmount"]);
29032912

0 commit comments

Comments
 (0)