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

Auto adjustment of difficulty of blocks #199

Merged
merged 10 commits into from May 27, 2018
Merged

Auto adjustment of difficulty of blocks #199

merged 10 commits into from May 27, 2018

Conversation

tbrand
Copy link
Contributor

@tbrand tbrand commented May 26, 2018

Description

Difficulty of blocks should be adjusted automatically.
I did the implementation.

Currently it aim to adjust to be 1 min for a mining.
We can do tuning for the time later.

Related Issues

Checklist

  • Every CI jobs finished successfully

@kingsleyh
Copy link
Contributor

kingsleyh commented May 26, 2018

I've fixed the specs - just one thing for you to check - I think there was a bug in the block_difficulty - so I switched the 60 secs to be after the 80 secs like this (otherwise 80 secs was never reached):

return Math.max(block.difficulty - 2, 1) if sec > 80
return Math.max(block.difficulty - 1, 1) if sec > 60

If it's all good - please merge

@tbrand
Copy link
Contributor Author

tbrand commented May 27, 2018

Oh nice fix! 👍 Thanks!

@tbrand tbrand merged commit deae187 into master May 27, 2018
@tbrand tbrand deleted the auto-difficulty branch May 27, 2018 04:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants