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 <pasta@dashboost.org>
This commit is contained in:
pasta committed 2020-06-05 15:01:26 -05:00
1 parent 01b45b2e01
commit a99a3c0bd6
1 file changed
+9
+9
View File
@@ -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"]);