Add more consensus information to the "server_info" RPC call.

This commit is contained in:
JoelKatz
2012-08-06 03:51:44 -07:00
parent efa3653b80
commit 7a5db15041
2 changed files with 22 additions and 0 deletions

View File

@@ -960,6 +960,25 @@ void LedgerConsensus::endConsensus()
Json::Value LedgerConsensus::getJson()
{
Json::Value ret(Json::objectValue);
ret["proposing"] = mProposing ? "yes" : "no";
ret["validating"] = mValidating ? "yes" : "no";
ret["synched"] = mHaveCorrectLCL ? "yes" : "no";
ret["proposers"] = static_cast<int>(mPeerPositions.size());
switch (mState)
{
case lcsPRE_CLOSE: ret["state"] = "open"; break;
case lcsESTABLISH: ret["state"] = "consensus"; break;
case lcsFINISHED: ret["state"] = "finished"; break;
case lcsACCEPTED: ret["state"] = "accepted"; break;
}
int v = mDisputes.size();
if (v != 0)
ret["disputes"] = v;
if (mOurPosition)
ret["our_position"] = mOurPosition->getJson();
return ret;
}