mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Fix the bug Jed reported where our second closed ledger has a close time in the past which
crashes the CLC timing code.
This commit is contained in:
@@ -71,7 +71,7 @@ Ledger::Ledger(bool dummy, Ledger& prevLedger) :
|
||||
prevLedger.getCloseAgree(), mLedgerSeq);
|
||||
if (prevLedger.mCloseTime == 0)
|
||||
{
|
||||
mCloseTime = theApp->getOPs().getCloseTimeNC();
|
||||
mCloseTime = theApp->getOPs().getCloseTimeNC() - mCloseResolution;
|
||||
mCloseTime -= (mCloseTime % mCloseResolution);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -19,13 +19,15 @@ int ContinuousLedgerTiming::shouldClose(
|
||||
int previousMSeconds, // seconds the previous ledger took to reach consensus
|
||||
int currentMSeconds) // seconds since the previous ledger closed
|
||||
{
|
||||
assert((previousMSeconds > -1000) && (previousMSeconds < 600000));
|
||||
assert((currentMSeconds >= -1000) && (currentMSeconds < 600000));
|
||||
|
||||
#if 0
|
||||
Log(lsTRACE) << boost::str(boost::format("CLC::shouldClose Trans=%s, Prop: %d/%d, Secs: %d (last:%d)") %
|
||||
(anyTransactions ? "yes" : "no") % previousProposers % proposersClosed % currentMSeconds % previousMSeconds);
|
||||
#endif
|
||||
if ((previousMSeconds < -1000) || (previousMSeconds > 600000) ||
|
||||
(currentMSeconds < -1000) || (currentMSeconds > 600000))
|
||||
{
|
||||
Log(lsFATAL) <<
|
||||
boost::str(boost::format("CLC::shouldClose range error Trans=%s, Prop: %d/%d, Secs: %d (last:%d)")
|
||||
% (anyTransactions ? "yes" : "no") % previousProposers % proposersClosed
|
||||
% currentMSeconds % previousMSeconds);
|
||||
return currentMSeconds;
|
||||
}
|
||||
|
||||
if (!anyTransactions)
|
||||
{ // no transactions so far this interval
|
||||
|
||||
Reference in New Issue
Block a user