diff --git a/nano/lib/stats.cpp b/nano/lib/stats.cpp index 437936004a..2401dfe950 100644 --- a/nano/lib/stats.cpp +++ b/nano/lib/stats.cpp @@ -218,11 +218,11 @@ void nano::stats::update_counter (nano::stats::counter_key key, std::functionsecond); - if (key != all_key) // Also update the `all` counter + if (key != all_key) { auto it_all = counters.find (all_key); release_assert (it_all != counters.end ()); // The `all` counter should always be created together - updater (*it_all->second); + updater (*it_all->second); // Also update the `all` counter } } } @@ -235,7 +235,11 @@ void nano::stats::update_counter (nano::stats::counter_key key, std::function ()); updater (*it->second); - updater (*it_all->second); + + if (key != all_key) + { + updater (*it_all->second); // Also update the `all` counter + } } }