diff --git a/nano/node/vote_cache.cpp b/nano/node/vote_cache.cpp index 9f61192653..bd9c7f4046 100644 --- a/nano/node/vote_cache.cpp +++ b/nano/node/vote_cache.cpp @@ -284,8 +284,23 @@ void nano::vote_cache::cleanup () std::unique_ptr nano::vote_cache::collect_container_info (const std::string & name) const { + nano::lock_guard guard{ mutex }; + + auto count_unique_votes = [this] () { + std::unordered_set> votes; + for (auto const & entry : cache) + { + for (auto const & vote : entry.votes ()) + { + votes.insert (vote); + } + } + return votes.size (); + }; + auto composite = std::make_unique (name); - composite->add_component (std::make_unique (container_info{ "cache", size (), sizeof (ordered_cache::value_type) })); + composite->add_component (std::make_unique (container_info{ "cache", cache.size (), sizeof (ordered_cache::value_type) })); + composite->add_component (std::make_unique (container_info{ "unique", count_unique_votes (), sizeof (nano::vote) })); return composite; }