RPC infrastructure for feature management.

This commit is contained in:
JoelKatz
2013-05-29 16:18:56 -07:00
parent d5b1970ab3
commit 5af4673104
5 changed files with 40 additions and 0 deletions

View File

@@ -310,6 +310,20 @@ Json::Value RPCParser::parseEvented(const Json::Value& jvParams)
return rpcError(rpcNO_EVENTS);
}
// feature [<feature>] [true|false]
Json::Value RPCParser::parseFeature(const Json::Value& jvParams)
{
Json::Value jvRequest(Json::objectValue);
if (jvParams.size() > 0)
jvRequest["feature"] = jvParams[0u].asString();
if (jvParams.size() > 1)
jvRequest["vote"] = boost::lexical_cast<bool>(jvParams[1u].asString());
return jvRequest;
}
// get_counts [<min_count>]
Json::Value RPCParser::parseGetCounts(const Json::Value& jvParams)
{
@@ -733,6 +747,7 @@ Json::Value RPCParser::parseCommand(std::string strMethod, Json::Value jvParams)
{ "book_offers", &RPCParser::parseBookOffers, 2, 7 },
{ "connect", &RPCParser::parseConnect, 1, 2 },
{ "consensus_info", &RPCParser::parseAsIs, 0, 0 },
{ "feature", &RPCParser::parseFeature, 0, 2 },
{ "get_counts", &RPCParser::parseGetCounts, 0, 1 },
{ "json", &RPCParser::parseJson, 2, 2 },
{ "ledger", &RPCParser::parseLedger, 0, 2 },