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"; } } 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; }