Skip to content

Commit

Permalink
fixup: avoid expensive evaluations in stats code
Browse files Browse the repository at this point in the history
  • Loading branch information
PastaPastaPasta committed Dec 17, 2024
1 parent 3574550 commit 7bbbc15
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/evo/deterministicmns.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -646,14 +646,16 @@ bool CDeterministicMNManager::ProcessBlock(const CBlock& block, gsl::not_null<co
updatesRet = {newList, oldList, diff};
}

::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());
::g_stats_client->gauge("masternodes.weighted_enabled", newList.GetValidWeightedMNsCount());
::g_stats_client->gauge("masternodes.evo.count", newList.GetAllEvoCount());
::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 (::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());
::g_stats_client->gauge("masternodes.weighted_enabled", newList.GetValidWeightedMNsCount());
::g_stats_client->gauge("masternodes.evo.count", newList.GetAllEvoCount());
::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()) {
Expand Down

0 comments on commit 7bbbc15

Please sign in to comment.