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 2020-06-05 13:40:02 -05:00
parent 01b45b2e01
commit a99a3c0bd6

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"]);