Enable batch rpc processing

* Can be exercised from the command line with json2

* Rewrite Env::do_rpc to call the same code as
  rpc from the command line.  This puts rpc
  handling logic in one place.
This commit is contained in:
Howard Hinnant
2017-09-21 15:16:39 -04:00
committed by seelabs
parent d61436cca5
commit cd19246937
10 changed files with 391 additions and 268 deletions

View File

@@ -465,31 +465,7 @@ Env::st (JTx const& jt)
Json::Value
Env::do_rpc(std::vector<std::string> const& args)
{
auto jv = cmdLineToJSONRPC(args, journal);
if (!jv.isMember(jss::jsonrpc))
{
jv[jss::jsonrpc] = "2.0";
jv[jss::ripplerpc] = "2.0";
jv[jss::id] = 5;
}
auto response = client().invoke(
jv[jss::method].asString(),
jv[jss::params][0U]);
if (jv.isMember(jss::jsonrpc))
{
response[jss::jsonrpc] = jv[jss::jsonrpc];
response[jss::ripplerpc] = jv[jss::ripplerpc];
response[jss::id] = jv[jss::id];
}
if (jv[jss::params][0u].isMember(jss::error) &&
(! response.isMember(jss::error)))
{
response["client_error"] = jv[jss::params][0u];
}
return response;
return rpcClient(args, app().config(), app().logs()).second;
}
void