Skip to content

Commit

Permalink
Replace random_access with sequenced in active_transactions (nanocu…
Browse files Browse the repository at this point in the history
  • Loading branch information
pwojcikdev authored and clemahieu committed Oct 1, 2022
1 parent fe71eae commit cc3156f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
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 @@ -581,7 +581,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

0 comments on commit cc3156f

Please sign in to comment.