Skip to content

Commit

Permalink
Remove by tally index
Browse files Browse the repository at this point in the history
  • Loading branch information
pwojcikdev committed Mar 23, 2024
1 parent 97d4dac commit aa64459
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
7 changes: 3 additions & 4 deletions nano/node/vote_cache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -244,13 +244,12 @@ std::vector<nano::vote_cache::top_entry> nano::vote_cache::top (const nano::uint
cleanup ();
}

for (auto & entry : cache.get<tag_tally> ())
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 () });
}
}

Expand Down
5 changes: 1 addition & 4 deletions nano/node/vote_cache.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,17 +164,14 @@ class vote_cache final
// clang-format off
class tag_sequenced {};
class tag_hash {};
class tag_tally {};
// clang-format on

// clang-format off
using ordered_cache = boost::multi_index_container<entry,
mi::indexed_by<
mi::hashed_unique<mi::tag<tag_hash>,
mi::const_mem_fun<entry, nano::block_hash, &entry::hash>>,
mi::sequenced<mi::tag<tag_sequenced>>,
mi::ordered_non_unique<mi::tag<tag_tally>,
mi::const_mem_fun<entry, nano::uint128_t, &entry::tally>, std::greater<>> // DESC
mi::sequenced<mi::tag<tag_sequenced>>
>>;
// clang-format on
ordered_cache cache;
Expand Down

0 comments on commit aa64459

Please sign in to comment.