-
Notifications
You must be signed in to change notification settings - Fork 1.1k
EIP2384 - Ice Age Adustment around Istanbul #211
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
Changes from all commits
c2d9593
79cd27b
7a8b5d8
72e9b6e
6c7c6e9
49a1aa6
e462b8b
194d1c7
880a298
33bf65b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,6 +20,7 @@ | |
|
|
||
| import java.math.BigInteger; | ||
|
|
||
| import com.google.common.annotations.VisibleForTesting; | ||
| import com.google.common.primitives.Ints; | ||
|
|
||
| /** Provides the various difficultly calculates used on mainnet hard forks. */ | ||
|
|
@@ -37,6 +38,7 @@ public abstract class MainnetDifficultyCalculators { | |
|
|
||
| private static final long BYZANTIUM_FAKE_BLOCK_OFFSET = 2_999_999L; | ||
| private static final long CONSTANTINOPLE_FAKE_BLOCK_OFFSET = 4_999_999L; | ||
| private static final long MUIR_GLACIER_FAKE_BLOCK_OFFSET = 8_999_999L; | ||
|
|
||
| private MainnetDifficultyCalculators() {} | ||
|
|
||
|
|
@@ -67,15 +69,20 @@ private MainnetDifficultyCalculators() {} | |
| return periodCount > 1 ? adjustForPeriod(periodCount, difficulty) : difficulty; | ||
| }; | ||
|
|
||
| @VisibleForTesting | ||
| public static DifficultyCalculator<Void> BYZANTIUM = | ||
| (time, parent, protocolContext) -> | ||
| calculateByzantiumDifficulty(time, parent, BYZANTIUM_FAKE_BLOCK_OFFSET); | ||
| calculateThawedDifficulty(time, parent, BYZANTIUM_FAKE_BLOCK_OFFSET); | ||
|
|
||
| public static DifficultyCalculator<Void> CONSTANTINOPLE = | ||
| static DifficultyCalculator<Void> CONSTANTINOPLE = | ||
| (time, parent, protocolContext) -> | ||
| calculateByzantiumDifficulty(time, parent, CONSTANTINOPLE_FAKE_BLOCK_OFFSET); | ||
| calculateThawedDifficulty(time, parent, CONSTANTINOPLE_FAKE_BLOCK_OFFSET); | ||
|
|
||
| private static BigInteger calculateByzantiumDifficulty( | ||
| static DifficultyCalculator<Void> MUIR_GLACIER = | ||
| (time, parent, protocolContext) -> | ||
| calculateThawedDifficulty(time, parent, MUIR_GLACIER_FAKE_BLOCK_OFFSET); | ||
|
RatanRSur marked this conversation as resolved.
|
||
|
|
||
| private static BigInteger calculateThawedDifficulty( | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could this be
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's used in 3 different places, Byzantium, Constantinople, and now MuirGlacier. Before it was |
||
| final long time, final BlockHeader parent, final long fakeBlockOffset) { | ||
| final BigInteger parentDifficulty = difficulty(parent.getDifficulty()); | ||
| final boolean hasOmmers = !parent.getOmmersHash().equals(Hash.EMPTY_LIST_HASH); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.