-
Notifications
You must be signed in to change notification settings - Fork 795
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
Use random shuffle for active_transactions::request_confirm () #1691
Conversation
for blocks rebroadcast & confirmation request in overload mode
requests_bundle.insert (std::make_pair (rep.endpoint, insert_vector)); | ||
} | ||
std::vector<std::pair<nano::block_hash, nano::block_hash>> insert_vector = { root_hash }; | ||
requests_bundle.insert (std::make_pair (rep.endpoint, insert_vector)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
emplace can be used here as well (see other comment)
{ | ||
while (requests_bundle.size () > max_broadcast_queue) | ||
{ | ||
requests_bundle.erase (requests_bundle.begin ()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can probably use the ranged version of erase
instead of a loop
{ | ||
confirm_req_bundle.push_back (std::make_pair (i->election->status.winner, reps)); | ||
} | ||
confirm_req_bundle.push_back (std::make_pair (i->election->status.winner, reps)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
emplace_back
can be used, which can save a copy/move, i.e:
confirm_req_bundle.emplace_back (i->election->status.winner, reps);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Now I guess we better make proper ordering for active transactions instead of random
Closing in favor of #1810 |
for blocks rebroadcast & confirmation request in overload mode