From b6d47508487310b44844682b737a1ccad886bdd5 Mon Sep 17 00:00:00 2001 From: JoelKatz Date: Wed, 20 Jun 2012 18:13:28 -0700 Subject: [PATCH 1/2] Don't consider the last closed consensus ledger as the next LCL. --- src/ValidationCollection.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/ValidationCollection.cpp b/src/ValidationCollection.cpp index e68aecd5ee..6761110b17 100644 --- a/src/ValidationCollection.cpp +++ b/src/ValidationCollection.cpp @@ -13,7 +13,7 @@ bool ValidationCollection::addValidation(SerializedValidation::pointer val) val->setTrusted(); uint64 now = theApp->getOPs().getNetworkTimeNC(); uint64 valClose = val->getCloseTime(); - if ((now > valClose) && (now < (valClose + 2 * LEDGER_INTERVAL))) + if ((now > valClose) && (now < (valClose + LEDGER_INTERVAL))) isCurrent = true; else Log(lsWARNING) << "Received stale validation now=" << now << ", close=" << valClose; @@ -85,10 +85,14 @@ boost::unordered_map ValidationCollection::getCurrentValidations() boost::unordered_map::iterator it = mCurrentValidations.begin(); while (it != mCurrentValidations.end()) { - if (now > (it->second->getCloseTime() + 2 * LEDGER_INTERVAL)) + if (now > (it->second->getCloseTime() + LEDGER_INTERVAL)) + { it = mCurrentValidations.erase(it); + Log(lsTRACE) << "Erasing validation for " << it->second->getLedgerHash().GetHex(); + } else { + Log(lsTRACE) << "Counting validation for " << it->second->getLedgerHash().GetHex(); ++ret[it->second->getLedgerHash()]; ++it; } From e63b68182da1be4dbb08091e3daa4efb02b10139 Mon Sep 17 00:00:00 2001 From: JoelKatz Date: Wed, 20 Jun 2012 18:25:29 -0700 Subject: [PATCH 2/2] Don't count unconnected peers. Remove a FIXME. --- src/NetworkOPs.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/NetworkOPs.cpp b/src/NetworkOPs.cpp index 09620bd1f5..40b08da42f 100644 --- a/src/NetworkOPs.cpp +++ b/src/NetworkOPs.cpp @@ -381,17 +381,17 @@ bool NetworkOPs::checkLastClosedLedger(const std::vector& peerLis { Log(lsDEBUG) << "NOP::CS Dead pointer in peer list"; } - else + else if ((*it)->isConnected()) { uint256 peerLedger = (*it)->getClosedLedgerHash(); if (!!peerLedger) { - // FIXME: If we have this ledger, don't count it if it's too far past its close time ValidationCount& vc = ledgers[peerLedger]; if ((vc.nodesUsing == 0) || ((*it)->getNodePublic() > vc.highNode)) vc.highNode = (*it)->getNodePublic(); ++vc.nodesUsing; } + else Log(lsTRACE) << "Connected peer announces no LCL"; } }