From ee71603dec884875642e43f963f2e741cfea5d9d Mon Sep 17 00:00:00 2001 From: JoelKatz Date: Thu, 30 Aug 2012 10:29:56 -0700 Subject: [PATCH] Logic error in last close logic making us thing consensus was slow. --- src/LedgerConsensus.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/LedgerConsensus.cpp b/src/LedgerConsensus.cpp index ea9f81e99a..e4df9584d2 100644 --- a/src/LedgerConsensus.cpp +++ b/src/LedgerConsensus.cpp @@ -440,24 +440,22 @@ void LedgerConsensus::statePreClose() int proposersClosed = mPeerPositions.size(); // This ledger is open. This computes how long since the last ledger closed - uint32 lastCloseTime; + int sinceClose; int ledgerInterval = 0; if (mHaveCorrectLCL && mPreviousLedger->getCloseAgree()) { // we can use consensus timing - lastCloseTime = mPreviousLedger->getCloseTimeNC(); + sinceClose = 1000 * (theApp->getOPs().getCloseTimeNC() - mPreviousLedger->getCloseTimeNC()); ledgerInterval = 2 * mPreviousLedger->getCloseResolution(); if (ledgerInterval < LEDGER_IDLE_INTERVAL) ledgerInterval = LEDGER_IDLE_INTERVAL; } else { - lastCloseTime = theApp->getOPs().getLastCloseTime(); + sinceClose = theApp->getOPs().getLastCloseTime(); ledgerInterval = LEDGER_IDLE_INTERVAL; } - int sinceClose = 1000 * (theApp->getOPs().getCloseTimeNC() - lastCloseTime); - if (sinceClose >= ContinuousLedgerTiming::shouldClose(anyTransactions, mPreviousProposers, proposersClosed, mPreviousMSeconds, sinceClose, ledgerInterval)) { // it is time to close the ledger