fixup: avoid expensive evaluations in stats code

This commit is contained in:
pasta 2024-12-17 11:39:31 -06:00
parent 3574550382
commit 7bbbc15db0
No known key found for this signature in database
GPG Key ID: 5255B86F912A614A

View File

@ -646,6 +646,7 @@ bool CDeterministicMNManager::ProcessBlock(const CBlock& block, gsl::not_null<co
updatesRet = {newList, oldList, diff};
}
if (::g_stats_client->active()) {
::g_stats_client->gauge("masternodes.count", newList.GetAllMNsCount());
::g_stats_client->gauge("masternodes.weighted_count", newList.GetValidWeightedMNsCount());
::g_stats_client->gauge("masternodes.enabled", newList.GetValidMNsCount());
@ -654,6 +655,7 @@ bool CDeterministicMNManager::ProcessBlock(const CBlock& block, gsl::not_null<co
::g_stats_client->gauge("masternodes.evo.enabled", newList.GetValidEvoCount());
::g_stats_client->gauge("masternodes.mn.count", newList.GetAllMNsCount() - newList.GetAllEvoCount());
::g_stats_client->gauge("masternodes.mn.enabled", newList.GetValidMNsCount() - newList.GetValidEvoCount());
}
if (nHeight == consensusParams.DIP0003EnforcementHeight) {
if (!consensusParams.DIP0003EnforcementHash.IsNull() && consensusParams.DIP0003EnforcementHash != pindex->GetBlockHash()) {