Merge branch 'master' of github.com:jedmccaleb/NewCoin

This commit is contained in:
Arthur Britto
2012-06-20 18:29:00 -07:00
2 changed files with 8 additions and 4 deletions

View File

@@ -381,17 +381,17 @@ bool NetworkOPs::checkLastClosedLedger(const std::vector<Peer::pointer>& 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";
}
}

View File

@@ -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<uint256, int> ValidationCollection::getCurrentValidations()
boost::unordered_map<uint160, SerializedValidation::pointer>::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;
}