mirror of
https://github.com/XRPLF/rippled.git
synced 2026-06-03 08:46:46 +00:00
fix get_counts
This commit is contained in:
@@ -3002,13 +3002,31 @@ static RPCCallTestData const rpcCallTestArray[] = {
|
||||
"get_counts",
|
||||
"-1",
|
||||
},
|
||||
RPCCallTestData::bad_cast,
|
||||
R"()"},
|
||||
RPCCallTestData::no_exception,
|
||||
R"({
|
||||
"method" : "get_counts",
|
||||
"params" : [
|
||||
{
|
||||
"error" : "invalidParams",
|
||||
"error_code" : 31,
|
||||
"error_message" : "Invalid field 'min_count'."
|
||||
}
|
||||
]
|
||||
})"},
|
||||
{"get_counts: count too large.",
|
||||
__LINE__,
|
||||
{"get_counts", "4294967296"},
|
||||
RPCCallTestData::bad_cast,
|
||||
R"()"},
|
||||
RPCCallTestData::no_exception,
|
||||
R"({
|
||||
"method" : "get_counts",
|
||||
"params" : [
|
||||
{
|
||||
"error" : "invalidParams",
|
||||
"error_code" : 31,
|
||||
"error_message" : "Invalid field 'min_count'."
|
||||
}
|
||||
]
|
||||
})"},
|
||||
|
||||
// json
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
@@ -546,7 +546,12 @@ private:
|
||||
Json::Value jvRequest(Json::objectValue);
|
||||
|
||||
if (jvParams.size())
|
||||
jvRequest[jss::min_count] = jvParams[0u].asUInt();
|
||||
{
|
||||
if (auto minCount = jvParseUInt(jvParams[0u]))
|
||||
jvRequest[jss::min_count] = *minCount;
|
||||
else
|
||||
return RPC::invalid_field_error(jss::min_count);
|
||||
}
|
||||
|
||||
return jvRequest;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user