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

Adjust difficulty gradually #213

Merged
merged 12 commits into from Apr 25, 2019

Conversation

earlbread
Copy link
Contributor

@earlbread earlbread commented Apr 20, 2019

  • Changed the difficulty calculation algorithm to gradually adjust the difficulty.
  • Removed HashDigest.HasLeadingZeroBits() method and added HashDigest.LessThanTarget() mtehod.
  • Changed difficulty type to long from int.
  • Changed BlockPolicy interface to receive the minimum difficulty and difficulty bound divisor.

@earlbread earlbread self-assigned this Apr 20, 2019
@earlbread earlbread force-pushed the difficulty-adjustment branch 4 times, most recently from 74b1e71 to 8250168 Compare April 23, 2019 07:19
@earlbread earlbread marked this pull request as ready for review April 23, 2019 07:21
@earlbread earlbread changed the title [WIP] Adjust difficulty gradually Adjust difficulty gradually Apr 23, 2019
@codecov
Copy link

codecov bot commented Apr 23, 2019

Codecov Report

Merging #213 into master will increase coverage by 0.29%.
The diff coverage is 92.85%.

@@            Coverage Diff             @@
##           master     #213      +/-   ##
==========================================
+ Coverage   83.52%   83.82%   +0.29%     
==========================================
  Files          74       74              
  Lines        3394     3407      +13     
==========================================
+ Hits         2835     2856      +21     
+ Misses        559      551       -8
Impacted Files Coverage Δ
Libplanet/Blockchain/BlockChain.cs 97.73% <100%> (ø) ⬆️
Libplanet/Blocks/RawBlock.cs 100% <100%> (ø) ⬆️
Libplanet/Blocks/Block.cs 97.95% <100%> (ø) ⬆️
Libplanet/Hashcash.cs 100% <100%> (ø) ⬆️
Libplanet/HashDigest.cs 100% <100%> (+2.56%) ⬆️
Libplanet/Blockchain/Policies/BlockPolicy.cs 93.75% <89.28%> (-6.25%) ⬇️
Libplanet/Net/Swarm.cs 80.58% <0%> (+1.11%) ⬆️

CHANGES.md Outdated Show resolved Hide resolved
Libplanet/Blockchain/Policies/BlockPolicy.cs Show resolved Hide resolved
Libplanet/HashDigest.cs Outdated Show resolved Hide resolved
Libplanet/HashDigest.cs Outdated Show resolved Hide resolved
Libplanet/HashDigest.cs Outdated Show resolved Hide resolved
@longfin
Copy link
Member

longfin commented Apr 25, 2019

It seems to need rebase. @earlbread

@earlbread
Copy link
Contributor Author

I rebased this on the master branch. @longfin

longfin
longfin previously approved these changes Apr 25, 2019
Libplanet/HashDigest.cs Outdated Show resolved Hide resolved
CHANGES.md Outdated Show resolved Hide resolved
Libplanet/Blockchain/Policies/BlockPolicy.cs Outdated Show resolved Hide resolved
Libplanet/Blockchain/Policies/BlockPolicy.cs Outdated Show resolved Hide resolved
Libplanet/Blockchain/Policies/BlockPolicy.cs Outdated Show resolved Hide resolved
Libplanet/Blockchain/Policies/BlockPolicy.cs Outdated Show resolved Hide resolved
Libplanet/Blockchain/Policies/BlockPolicy.cs Outdated Show resolved Hide resolved
Libplanet/Blockchain/Policies/BlockPolicy.cs Outdated Show resolved Hide resolved
Libplanet/Hashcash.cs Show resolved Hide resolved
@earlbread
Copy link
Contributor Author

I applied review comments and rebased on the master branch. Please take a look.

CHANGES.md Outdated Show resolved Hide resolved
CHANGES.md Outdated Show resolved Hide resolved
@earlbread
Copy link
Contributor Author

I applied what you mentioned. @dahlia

CHANGES.md Outdated Show resolved Hide resolved
@earlbread earlbread merged commit 78748ef into planetarium:master Apr 25, 2019
@earlbread earlbread deleted the difficulty-adjustment branch April 25, 2019 16:05
limebell added a commit to limebell/libplanet that referenced this pull request Jul 7, 2021
OnedgeLee pushed a commit to OnedgeLee/libplanet that referenced this pull request Jan 31, 2023
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

3 participants