Merge pull request #3543

6fc97c9 blockchain_usage: don't divide by 0 when there is nothing to process (moneromooo-monero)
This commit is contained in:
luigi1111 2018-05-31 14:36:33 -05:00
commit c8378933ae
No known key found for this signature in database
GPG key ID: F4ACA0183641E010

View file

@ -243,10 +243,17 @@ int main(int argc, char* argv[])
counts[out.second.size()]++;
total++;
}
for (const auto &c: counts)
if (total > 0)
{
float percent = 100.f * c.second / total;
MINFO(std::to_string(c.second) << " outputs used " << c.first << " times (" << percent << "%)");
for (const auto &c: counts)
{
float percent = 100.f * c.second / total;
MINFO(std::to_string(c.second) << " outputs used " << c.first << " times (" << percent << "%)");
}
}
else
{
MINFO("No outputs to process");
}
LOG_PRINT_L0("Blockchain usage exported OK");