From cdd1bff788f7a53440cef063b030f574aeaf10fe Mon Sep 17 00:00:00 2001 From: JoelKatz Date: Thu, 12 Jul 2012 01:43:35 -0700 Subject: [PATCH] Sometimes it's okay to be clever. --- src/LedgerTiming.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/LedgerTiming.cpp b/src/LedgerTiming.cpp index b7a3b77344..fe6771a223 100644 --- a/src/LedgerTiming.cpp +++ b/src/LedgerTiming.cpp @@ -3,8 +3,8 @@ #include -// NOTE: Last time must be repeated -int ContinuousLedgerTiming::LedgerTimeResolution[] = { 10, 20, 30, 60, 90, 120, 120 }; +// NOTE: First and last times must be repeated +int ContinuousLedgerTiming::LedgerTimeResolution[] = { 10, 10, 20, 30, 60, 90, 120, 120 }; // Called when a ledger is open and no close is in progress -- when a transaction is received and no close // is in process, or when a close completes. Returns the number of seconds the ledger should be be open. @@ -72,15 +72,15 @@ int ContinuousLedgerTiming::getNextLedgerTimeResolution(int previousResolution, assert(ledgerSeq); if ((!previousAgree) && ((ledgerSeq % LEDGER_RES_DECREASE) == 0)) { // reduce resolution - int i = 0; + int i = 1; while (LedgerTimeResolution[i] != previousResolution) ++i; - return LedgerTimeResolution[(i != 0) ? (i - 1) : i]; + return LedgerTimeResolution[i - 1]; } if ((previousAgree) && ((ledgerSeq % LEDGER_RES_INCREASE) == 0)) { // increase resolution - int i = 0; + int i = 1; while (LedgerTimeResolution[i] != previousResolution) ++i; return LedgerTimeResolution[i + 1];