mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Function to get full/partial validation counts for tracking transaction load.
Cleanups.
This commit is contained in:
@@ -97,12 +97,12 @@ void ValidationCollection::getValidationCount(const uint256& ledger, bool curren
|
||||
uint32 now = theApp->getOPs().getNetworkTimeNC();
|
||||
if (set)
|
||||
{
|
||||
for (ValidationSet::iterator vit = set->begin(), end = set->end(); vit != end; ++vit)
|
||||
BOOST_FOREACH(u160_val_pair& it, *set)
|
||||
{
|
||||
bool isTrusted = vit->second->isTrusted();
|
||||
bool isTrusted = it.second->isTrusted();
|
||||
if (isTrusted && currentOnly)
|
||||
{
|
||||
uint32 closeTime = vit->second->getSignTime();
|
||||
uint32 closeTime = it.second->getSignTime();
|
||||
if ((now < (closeTime - LEDGER_EARLY_INTERVAL)) || (now > (closeTime + LEDGER_VAL_INTERVAL)))
|
||||
isTrusted = false;
|
||||
else
|
||||
@@ -119,6 +119,28 @@ void ValidationCollection::getValidationCount(const uint256& ledger, bool curren
|
||||
cLog(lsTRACE) << "VC: " << ledger << "t:" << trusted << " u:" << untrusted;
|
||||
}
|
||||
|
||||
void ValidationCollection::getValidationTypes(const uint256& ledger, int& full, int& partial)
|
||||
{
|
||||
full = partial = 0;
|
||||
boost::mutex::scoped_lock sl(mValidationLock);
|
||||
VSpointer set = findSet(ledger);
|
||||
if (set)
|
||||
{
|
||||
BOOST_FOREACH(u160_val_pair& it, *set)
|
||||
{
|
||||
if (it.second->isTrusted())
|
||||
{
|
||||
if (it.second->isFull())
|
||||
++full;
|
||||
else
|
||||
++partial;
|
||||
}
|
||||
}
|
||||
}
|
||||
cLog(lsTRACE) << "VC: " << ledger << "f:" << full << " p:" << partial;
|
||||
}
|
||||
|
||||
|
||||
int ValidationCollection::getTrustedValidationCount(const uint256& ledger)
|
||||
{
|
||||
int trusted = 0;
|
||||
@@ -126,9 +148,9 @@ int ValidationCollection::getTrustedValidationCount(const uint256& ledger)
|
||||
VSpointer set = findSet(ledger);
|
||||
if (set)
|
||||
{
|
||||
for (ValidationSet::iterator vit = set->begin(), end = set->end(); vit != end; ++vit)
|
||||
BOOST_FOREACH(u160_val_pair& it, *set)
|
||||
{
|
||||
if (vit->second->isTrusted())
|
||||
if (it.second->isTrusted())
|
||||
++trusted;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,6 +38,7 @@ public:
|
||||
bool addValidation(const SerializedValidation::pointer&);
|
||||
ValidationSet getValidations(const uint256& ledger);
|
||||
void getValidationCount(const uint256& ledger, bool currentOnly, int& trusted, int& untrusted);
|
||||
void getValidationTypes(const uint256& ledger, int& full, int& partial);
|
||||
|
||||
int getTrustedValidationCount(const uint256& ledger);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user