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

recalculate work for long unconfirmed local blocks #1860

Closed
wants to merge 3 commits into from
Closed

recalculate work for long unconfirmed local blocks #1860

wants to merge 3 commits into from

Conversation

argakiig
Copy link
Contributor

using a difficulty threshold of the long unconfirmed block
#1858 allows for recalculating with a threshold of active_difficulty instead
part of #1336

@argakiig argakiig added enhancement quality improvements This item indicates the need for or supplies changes that improve maintainability incomplete This item is incomplete and should not be merged if it is a pull request functionality quality improvements This item indicates the need for or supplies a better way to implement existing functionality low effort remaining labels Mar 25, 2019
@argakiig argakiig added this to the V19.0 milestone Mar 25, 2019
@argakiig
Copy link
Contributor Author

rebased to dd46609 and adjusted to calculate new work above active_difficulty every announcement period.

@argakiig argakiig removed the incomplete This item is incomplete and should not be merged if it is a pull request label Mar 30, 2019
auto callback = [node_l, block_l, election_l](boost::optional<uint64_t> const & work_a) {
if (work_a && !nano::work_validate (block_l->root (), work_a.get ()))
{
block_l->block_work_set (work_a.get ());
Copy link
Contributor

@cryptocode cryptocode Apr 4, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This updates a block's work field without a lock / it's not atomic.
Because of the block uniquer, I believe the same block can be accessed or have its work validated by other threads (such as the same block arriving again over bootstrap or realtime traffic)

@argakiig argakiig removed this from the V19.0 milestone Apr 22, 2019
@argakiig argakiig closed this Apr 22, 2019
@argakiig argakiig deleted the recalculate_work branch April 22, 2019 17:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement functionality quality improvements This item indicates the need for or supplies a better way to implement existing functionality low effort remaining quality improvements This item indicates the need for or supplies changes that improve maintainability
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants