Don't show our validation key in non-admin server_info.

This commit is contained in:
JoelKatz
2013-01-15 17:03:00 -08:00
parent 940cc9059c
commit d398c5bb02
3 changed files with 10 additions and 5 deletions

View File

@@ -1093,7 +1093,7 @@ bool NetworkOPs::recvValidation(const SerializedValidation::pointer& val)
return theApp->getValidations().addValidation(val); return theApp->getValidations().addValidation(val);
} }
Json::Value NetworkOPs::getServerInfo() Json::Value NetworkOPs::getServerInfo(bool admin)
{ {
Json::Value info = Json::objectValue; Json::Value info = Json::objectValue;
@@ -1111,8 +1111,13 @@ Json::Value NetworkOPs::getServerInfo()
if (mNeedNetworkLedger) if (mNeedNetworkLedger)
info["network_ledger"] = "waiting"; info["network_ledger"] = "waiting";
if (admin)
{
if (theConfig.VALIDATION_PUB.isValid()) if (theConfig.VALIDATION_PUB.isValid())
info["pubkey_validator"] = theConfig.VALIDATION_PUB.humanNodePublic(); info["pubkey_validator"] = theConfig.VALIDATION_PUB.humanNodePublic();
else
info["pubkey_validator"] = "none";
}
info["pubkey_node"] = theApp->getWallet().getNodePublic().humanNodePublic(); info["pubkey_node"] = theApp->getWallet().getNodePublic().humanNodePublic();

View File

@@ -243,7 +243,7 @@ public:
int getPreviousConvergeTime() { return mLastCloseConvergeTime; } int getPreviousConvergeTime() { return mLastCloseConvergeTime; }
uint32 getLastCloseTime() { return mLastCloseTime; } uint32 getLastCloseTime() { return mLastCloseTime; }
void setLastCloseTime(uint32 t) { mLastCloseTime = t; } void setLastCloseTime(uint32 t) { mLastCloseTime = t; }
Json::Value getServerInfo(); Json::Value getServerInfo(bool admin);
uint32 acceptLedger(); uint32 acceptLedger();
boost::unordered_map<uint160, boost::unordered_map<uint160,
std::list<LedgerProposal::pointer> >& peekStoredProposals() { return mStoredProposals; } std::list<LedgerProposal::pointer> >& peekStoredProposals() { return mStoredProposals; }

View File

@@ -1305,7 +1305,7 @@ Json::Value RPCHandler::doServerInfo(Json::Value)
{ {
Json::Value ret(Json::objectValue); Json::Value ret(Json::objectValue);
ret["info"] = theApp->getOPs().getServerInfo(); ret["info"] = theApp->getOPs().getServerInfo(mRole == ADMIN);
return ret; return ret;
} }