mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-22 12:05:53 +00:00
Clean up some confusion about the last validated ledger versus the last published ledger.
This commit is contained in:
@@ -23,6 +23,23 @@ Ledger::ref LedgerMaster::getCurrentSnapshot ()
|
|||||||
return mCurrentSnapshot;
|
return mCurrentSnapshot;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int LedgerMaster::getPublishedLedgerAge ()
|
||||||
|
{
|
||||||
|
boost::recursive_mutex::scoped_lock ml (mLock);
|
||||||
|
if (!mPubLedger)
|
||||||
|
{
|
||||||
|
WriteLog (lsDEBUG, LedgerMaster) << "No published ledger";
|
||||||
|
return 999999;
|
||||||
|
}
|
||||||
|
|
||||||
|
int64 ret = getApp().getOPs ().getCloseTimeNC ();
|
||||||
|
ret -= static_cast<int64> (mPubLedger->getCloseTimeNC ());
|
||||||
|
ret = std::max (0LL, ret);
|
||||||
|
|
||||||
|
WriteLog (lsTRACE, LedgerMaster) << "Published ledger age is " << ret;
|
||||||
|
return static_cast<int> (ret);
|
||||||
|
}
|
||||||
|
|
||||||
int LedgerMaster::getValidatedLedgerAge ()
|
int LedgerMaster::getValidatedLedgerAge ()
|
||||||
{
|
{
|
||||||
boost::recursive_mutex::scoped_lock ml (mLock);
|
boost::recursive_mutex::scoped_lock ml (mLock);
|
||||||
@@ -42,7 +59,7 @@ int LedgerMaster::getValidatedLedgerAge ()
|
|||||||
|
|
||||||
bool LedgerMaster::isCaughtUp(std::string& reason)
|
bool LedgerMaster::isCaughtUp(std::string& reason)
|
||||||
{
|
{
|
||||||
if (getValidatedLedgerAge() > 180)
|
if (getPublishedLedgerAge() > 180)
|
||||||
{
|
{
|
||||||
reason = "No recently-validated ledger";
|
reason = "No recently-validated ledger";
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -58,11 +58,19 @@ public:
|
|||||||
return mFinalizedLedger;
|
return mFinalizedLedger;
|
||||||
}
|
}
|
||||||
|
|
||||||
// The published ledger is the last fully validated ledger
|
// The validated ledger is the last fully validated ledger
|
||||||
Ledger::ref getValidatedLedger ()
|
Ledger::ref getValidatedLedger ()
|
||||||
|
{
|
||||||
|
return mValidLedger;
|
||||||
|
}
|
||||||
|
|
||||||
|
// This is the last ledger we published to clients and can lag the validated ledger
|
||||||
|
Ledger::ref getPublishedLedger ()
|
||||||
{
|
{
|
||||||
return mPubLedger;
|
return mPubLedger;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int getPublishedLedgerAge ();
|
||||||
int getValidatedLedgerAge ();
|
int getValidatedLedgerAge ();
|
||||||
bool isCaughtUp(std::string& reason);
|
bool isCaughtUp(std::string& reason);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user