Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace random_access with sequenced in active_transactions #3957

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions nano/node/active_transactions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ std::vector<std::shared_ptr<nano::election>> nano::active_transactions::list_act
std::vector<std::shared_ptr<nano::election>> result_l;
result_l.reserve (std::min (max_a, roots.size ()));
{
auto & sorted_roots_l (roots.get<tag_random_access> ());
auto & sorted_roots_l (roots.get<tag_sequenced> ());
std::size_t count_l{ 0 };
for (auto i = sorted_roots_l.begin (), n = sorted_roots_l.end (); i != n && count_l < max_a; ++i, ++count_l)
{
Expand Down Expand Up @@ -590,7 +590,7 @@ void nano::active_transactions::erase_oldest ()
if (!roots.empty ())
{
node.stats.inc (nano::stat::type::election, nano::stat::detail::election_drop_overflow);
auto item = roots.get<tag_random_access> ().front ();
auto item = roots.get<tag_sequenced> ().front ();
cleanup_election (lock, item.election);
}
}
Expand Down
6 changes: 2 additions & 4 deletions nano/node/active_transactions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,8 @@ class active_transactions final

// clang-format off
class tag_account {};
class tag_random_access {};
class tag_root {};
class tag_sequence {};
class tag_sequenced {};
class tag_uncemented {};
class tag_arrival {};
class tag_hash {};
Expand All @@ -138,13 +137,12 @@ class active_transactions final
// clang-format off
using ordered_roots = boost::multi_index_container<conflict_info,
mi::indexed_by<
mi::random_access<mi::tag<tag_random_access>>,
mi::sequenced<mi::tag<tag_sequenced>>,
mi::hashed_unique<mi::tag<tag_root>,
mi::member<conflict_info, nano::qualified_root, &conflict_info::root>>
>>;
// clang-format on
ordered_roots roots;
using roots_iterator = active_transactions::ordered_roots::index_iterator<tag_root>::type;

explicit active_transactions (nano::node &, nano::confirmation_height_processor &);
~active_transactions ();
Expand Down