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

Use random shuffle for active_transactions::request_confirm () #1691

Closed
wants to merge 3 commits into from

Conversation

SergiySW
Copy link
Contributor

@SergiySW SergiySW commented Feb 3, 2019

for blocks rebroadcast & confirmation request in overload mode

for blocks rebroadcast & confirmation request in overload mode
@SergiySW SergiySW added this to the V18.0 milestone Feb 3, 2019
@SergiySW SergiySW self-assigned this Feb 3, 2019
@argakiig argakiig modified the milestones: V18.0, V19.0 Feb 5, 2019
@argakiig argakiig modified the milestones: V19.0, V18.0 Feb 5, 2019
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));
Copy link
Contributor

@wezrule wezrule Feb 22, 2019

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 ());
Copy link
Contributor

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));
Copy link
Contributor

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);

Copy link
Contributor Author

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

@SergiySW
Copy link
Contributor Author

SergiySW commented Mar 8, 2019

Closing in favor of #1810

@SergiySW SergiySW closed this Mar 8, 2019
@zhyatt zhyatt removed this from the V19.0 milestone Apr 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants