From 03e8104f6249dc8a50dd46af3df55ec66cb9e1d7 Mon Sep 17 00:00:00 2001 From: JoelKatz Date: Tue, 7 Aug 2012 01:39:34 -0700 Subject: [PATCH] Small close time consensus fix. --- src/LedgerConsensus.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/LedgerConsensus.cpp b/src/LedgerConsensus.cpp index 6902ab659..0d53af7b8 100644 --- a/src/LedgerConsensus.cpp +++ b/src/LedgerConsensus.cpp @@ -527,7 +527,15 @@ void LedgerConsensus::updateOurPositions() neededWeight = AV_MID_CONSENSUS_PCT; else neededWeight = AV_LATE_CONSENSUS_PCT; + uint32 closeTime = 0; + mHaveCloseTimeConsensus = false; + int thresh = mPeerPositions.size(); + if (thresh == 0) + { // no other times + mHaveCloseTimeConsensus = true; + closeTime = mOurPosition->getCloseTime() - (mOurPosition->getCloseTime() % mCloseResolution); + } if (mProposing) { ++closeTimes[mOurPosition->getCloseTime() - (mOurPosition->getCloseTime() % mCloseResolution)]; @@ -535,8 +543,6 @@ void LedgerConsensus::updateOurPositions() } thresh = thresh * neededWeight / 100; - uint32 closeTime = 0; - mHaveCloseTimeConsensus = false; for (std::map::iterator it = closeTimes.begin(), end = closeTimes.end(); it != end; ++it) { Log(lsINFO) << "CCTime: " << it->first << " has " << it->second << " out of " << thresh;