mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
More json information about consensus process.
Fix a bug where swithing ledgers during the consensus window caused us to use the wrong close resolution.
This commit is contained in:
@@ -201,7 +201,7 @@ LedgerConsensus::LedgerConsensus(const uint256& prevLCLHash, Ledger::pointer pre
|
||||
assert(mPreviousMSeconds);
|
||||
|
||||
mCloseResolution = ContinuousLedgerTiming::getNextLedgerTimeResolution(
|
||||
previousLedger->getCloseResolution(), previousLedger->getCloseAgree(), previousLedger->getLedgerSeq() + 1);
|
||||
mPreviousLedger->getCloseResolution(), mPreviousLedger->getCloseAgree(), previousLedger->getLedgerSeq() + 1);
|
||||
|
||||
mHaveCorrectLCL = previousLedger->getHash() == prevLCLHash;
|
||||
|
||||
@@ -464,6 +464,9 @@ void LedgerConsensus::timerEntry()
|
||||
theApp->getOPs().switchLastClosedLedger(consensus, true);
|
||||
mPreviousLedger = consensus;
|
||||
mHaveCorrectLCL = true;
|
||||
mCloseResolution = ContinuousLedgerTiming::getNextLedgerTimeResolution(
|
||||
mPreviousLedger->getCloseResolution(), mPreviousLedger->getCloseAgree(),
|
||||
mPreviousLedger->getLedgerSeq() + 1);
|
||||
}
|
||||
else Log(lsINFO) << "We still don't have it";
|
||||
}
|
||||
@@ -962,9 +965,17 @@ 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());
|
||||
|
||||
if (mHaveCorrectLCL)
|
||||
{
|
||||
ret["synched"] = "yes";
|
||||
ret["ledger_seq"] = mPreviousLedger->getLedgerSeq() + 1;
|
||||
ret["close_granularity"] = mCloseResolution;
|
||||
}
|
||||
else
|
||||
ret["synched"] = "no";
|
||||
|
||||
switch (mState)
|
||||
{
|
||||
case lcsPRE_CLOSE: ret["state"] = "open"; break;
|
||||
|
||||
@@ -72,4 +72,18 @@ std::vector<unsigned char> LedgerProposal::sign(void)
|
||||
return ret;
|
||||
}
|
||||
|
||||
Json::Value LedgerProposal::getJson() const
|
||||
{
|
||||
Json::Value ret = Json::objectValue;
|
||||
ret["previous_ledger"] = mPreviousLedger.GetHex();
|
||||
ret["transaction_hash"] = mCurrentHash.GetHex();
|
||||
ret["close_time"] = mCloseTime;
|
||||
ret["propose_seq"] = mProposeSeq;
|
||||
|
||||
if (mPublicKey.isValid())
|
||||
ret["peer_id"] = mPublicKey.humanNodePublic();
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
// vim:ts=4
|
||||
|
||||
Reference in New Issue
Block a user