-
Notifications
You must be signed in to change notification settings - Fork 223
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 the difficulty in the first difficultyAdjustmentWindowSize blocks #1592
Conversation
…tWindowSize blocks
@@ -46,6 +50,13 @@ func (pmtm *pastMedianTimeManager) PastMedianTime(blockHash *externalapi.DomainH | |||
if err != nil { | |||
return 0, err | |||
} | |||
if len(window) == 0 { | |||
header, err := pmtm.blockHeaderStore.BlockHeader(pmtm.databaseContext, pmtm.genesisHash) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's very weird to check the window size and then give the timestamp of a hard coded hash. I would expect to choose between:
a. if window size is 0 -> return blockHash's timetstamp
b. if blockHash == genesis -> return genesis' timetstamp
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But it's not only the genesis, it's also any block pointing at the genesis
if (shouldPass && err != nil) || (!shouldPass && !errors.Is(err, ruleerrors.ErrUnfinalizedTx)) { | ||
t.Fatalf("Unexpected error: %+v", err) | ||
t.Fatalf("ShouldPass: %t Unexpected error: %+v", shouldPass, err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why capital S?
Codecov Report
@@ Coverage Diff @@
## v0.10.0-dev #1592 +/- ##
===============================================
+ Coverage 59.89% 60.06% +0.16%
===============================================
Files 514 514
Lines 20255 20251 -4
===============================================
+ Hits 12132 12163 +31
+ Misses 6202 6163 -39
- Partials 1921 1925 +4
Continue to review full report at Codecov.
|
Closes #1546
The solution is this: #1546 (comment)