This change allows to do
[&](const RPCContext& ctx) -> UniValue
instead of
[&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
So RPCContext ties RPCHelpMan and JSONRPCRequest. Then ctx is used to get actual parameter values. For instance, before:
int timeout = 0;
if (!request.params[0].isNull())
timeout = request.params[0].get_int();
and now
int timeout = ctx.param<int>(0);
Not that the default value defined in the RPC spec is used.
It is also possible to iterate an array parameter:
std::set<std::string> stats;
ctx.param(1).forEach([&](const UniValue& stat) {
stats.insert(stat.get_str());
});
Or even do custom parameter handling:
int verbosity = ctx.param(1, [](const UniValue& param) -> int {
if (param.isNull()) return 1;
if (param.isNum()) return param.get_int();
return param.get_bool() ? 1 : 0;
});