From c734caf4d1ad840df83983e40b86e5d2c1f56a69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Wo=CC=81jcik?= <3044353+pwojcikdev@users.noreply.github.com> Date: Thu, 21 Mar 2024 17:23:42 +0100 Subject: [PATCH] Remove by tally index --- nano/node/vote_cache.cpp | 7 +++---- nano/node/vote_cache.hpp | 5 +---- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/nano/node/vote_cache.cpp b/nano/node/vote_cache.cpp index 63d6f6060d..f3eaec23c0 100644 --- a/nano/node/vote_cache.cpp +++ b/nano/node/vote_cache.cpp @@ -244,13 +244,12 @@ std::vector nano::vote_cache::top (const nano::uint cleanup (); } - for (auto & entry : cache.get ()) + for (auto & entry : cache) { - if (entry.tally () < min_tally) + if (entry.tally () >= min_tally) { - break; + results.push_back ({ entry.hash (), entry.tally (), entry.final_tally () }); } - results.push_back ({ entry.hash (), entry.tally (), entry.final_tally () }); } } diff --git a/nano/node/vote_cache.hpp b/nano/node/vote_cache.hpp index 06e4481d19..55d1256cf6 100644 --- a/nano/node/vote_cache.hpp +++ b/nano/node/vote_cache.hpp @@ -164,7 +164,6 @@ class vote_cache final // clang-format off class tag_sequenced {}; class tag_hash {}; - class tag_tally {}; // clang-format on // clang-format off @@ -172,9 +171,7 @@ class vote_cache final mi::indexed_by< mi::hashed_unique, mi::const_mem_fun>, - mi::sequenced>, - mi::ordered_non_unique, - mi::const_mem_fun, std::greater<>> // DESC + mi::sequenced> >>; // clang-format on ordered_cache cache;