mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Bugfix. Don't use rounded ledger timing to decide when to close an idle ledger.
This commit is contained in:
@@ -142,6 +142,7 @@ void Application::run()
|
||||
secondLedger->setAccepted();
|
||||
mMasterLedger.pushLedger(secondLedger, boost::make_shared<Ledger>(true, boost::ref(*secondLedger)));
|
||||
assert(!!secondLedger->getAccountState(rootAddress));
|
||||
mNetOps.setLastCloseNetTime(secondLedger->getCloseTimeNC());
|
||||
}
|
||||
|
||||
mNetOps.setStateTimer();
|
||||
|
||||
@@ -374,16 +374,17 @@ int LedgerConsensus::statePreClose()
|
||||
bool anyTransactions = theApp->getMasterLedger().getCurrentLedger()->peekTransactionMap()->getHash().isNonZero();
|
||||
int proposersClosed = mPeerPositions.size();
|
||||
|
||||
int sinceClose = theApp->getOPs().getNetworkTimeNC() - mPreviousLedger->getCloseTimeNC();
|
||||
int sinceClose = theApp->getOPs().getNetworkTimeNC() - theApp->getOPs().getLastCloseNetTime();
|
||||
|
||||
if (ContinuousLedgerTiming::shouldClose(anyTransactions, mPreviousProposers, proposersClosed,
|
||||
mPreviousSeconds, sinceClose) <= sinceClose)
|
||||
if (sinceClose >= ContinuousLedgerTiming::shouldClose(anyTransactions, mPreviousProposers, proposersClosed,
|
||||
mPreviousSeconds, sinceClose))
|
||||
{ // it is time to close the ledger (swap default and wobble ledgers)
|
||||
Log(lsINFO) << "CLC:: closing ledger";
|
||||
mState = lcsESTABLISH;
|
||||
mConsensusStartTime = boost::posix_time::second_clock::universal_time();
|
||||
theApp->getMasterLedger().closeTime();
|
||||
mCloseTime = theApp->getOPs().getNetworkTimeNC();
|
||||
theApp->getOPs().setLastCloseNetTime(mCloseTime);
|
||||
statusChange(newcoin::neCLOSING_LEDGER, mPreviousLedger);
|
||||
Ledger::pointer initial = theApp->getMasterLedger().endWobble();
|
||||
assert (initial->getParentHash() == mPreviousLedger->getHash());
|
||||
|
||||
@@ -63,6 +63,7 @@ protected:
|
||||
// last ledger close
|
||||
int mLastCloseProposers, mLastCloseConvergeTime;
|
||||
uint256 mLastCloseHash;
|
||||
uint32 mLastCloseNetTime;
|
||||
|
||||
// XXX Split into more locks.
|
||||
boost::interprocess::interprocess_upgradable_mutex mMonitorLock;
|
||||
@@ -170,8 +171,10 @@ public:
|
||||
void endConsensus();
|
||||
void setStateTimer();
|
||||
void newLCL(int proposers, int convergeTime, const uint256& ledgerHash);
|
||||
int getPreviousProposers() { return mLastCloseProposers; }
|
||||
int getPreviousSeconds() { return mLastCloseConvergeTime; }
|
||||
int getPreviousProposers() { return mLastCloseProposers; }
|
||||
int getPreviousSeconds() { return mLastCloseConvergeTime; }
|
||||
uint32 getLastCloseNetTime() { return mLastCloseNetTime; }
|
||||
void setLastCloseNetTime(uint32 t) { mLastCloseNetTime = t; }
|
||||
Json::Value getServerInfo();
|
||||
|
||||
// client information retrieval functions
|
||||
|
||||
Reference in New Issue
Block a user