From a089dd5460db00fe239db7f2a2dc8d7758dd6db9 Mon Sep 17 00:00:00 2001 From: JoelKatz Date: Fri, 3 Aug 2012 02:57:14 -0700 Subject: [PATCH] Fix a bug in how we count validations. --- src/ValidationCollection.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/ValidationCollection.cpp b/src/ValidationCollection.cpp index fcbe669b9c..bd1f9a6731 100644 --- a/src/ValidationCollection.cpp +++ b/src/ValidationCollection.cpp @@ -7,8 +7,9 @@ bool ValidationCollection::addValidation(SerializedValidation::pointer val) { + NewcoinAddress signer = val->getSignerPublic(); bool isCurrent = false; - if (theApp->getUNL().nodeInUNL(val->getSignerPublic())) + if (theApp->getUNL().nodeInUNL(signer)) { val->setTrusted(); uint32 now = theApp->getOPs().getNetworkTimeNC(); @@ -20,7 +21,7 @@ bool ValidationCollection::addValidation(SerializedValidation::pointer val) } uint256 hash = val->getLedgerHash(); - uint160 node = val->getSignerPublic().getNodeID(); + uint160 node = signer.getNodeID(); { boost::mutex::scoped_lock sl(mValidationLock); @@ -39,7 +40,7 @@ bool ValidationCollection::addValidation(SerializedValidation::pointer val) } } - Log(lsINFO) << "Val for " << hash.GetHex() << " from " << val->getSignerPublic().humanNodePublic() + Log(lsINFO) << "Val for " << hash.GetHex() << " from " << signer.humanNodePublic() << " added " << (val->isTrusted() ? "trusted" : "UNtrusted"); return isCurrent; } @@ -50,7 +51,8 @@ ValidationSet ValidationCollection::getValidations(const uint256& ledger) { boost::mutex::scoped_lock sl(mValidationLock); boost::unordered_map::iterator it = mValidations.find(ledger); - if (it != mValidations.end()) ret = it->second; + if (it != mValidations.end()) + ret = it->second; } return ret; } @@ -70,7 +72,7 @@ void ValidationCollection::getValidationCount(const uint256& ledger, bool curren { uint32 closeTime = vit->second->getCloseTime(); if ((now < closeTime) || (now > (closeTime + 2 * LEDGER_MAX_INTERVAL))) - trusted = false; + isTrusted = false; } if (isTrusted) ++trusted;