Remove by tally index

This commit is contained in:
Piotr Wójcik 2024-03-21 17:23:42 +01:00
commit c734caf4d1
2 changed files with 4 additions and 8 deletions

View file

@ -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 () });
}
}

View file

@ -164,7 +164,6 @@ private:
// clang-format off
class tag_sequenced {};
class tag_hash {};
class tag_tally {};
// clang-format on
// clang-format off
@ -172,9 +171,7 @@ private:
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;