-
Notifications
You must be signed in to change notification settings - Fork 230
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
Add cache to block window #1948
Conversation
Codecov Report
@@ Coverage Diff @@
## dev #1948 +/- ##
==========================================
+ Coverage 61.06% 61.11% +0.04%
==========================================
Files 640 643 +3
Lines 30034 30155 +121
==========================================
+ Hits 18341 18428 +87
- Misses 9095 9114 +19
- Partials 2598 2613 +15
Continue to review full report at Codecov.
|
02f8d3c
to
14885a8
Compare
@@ -45,6 +67,37 @@ func (dtm *dagTraversalManager) calculateBlockWindowHeap(stagingArea *model.Stag | |||
return nil, err | |||
} | |||
|
|||
_, err = dtm.daaWindowStore.DAAWindowBlock(dtm.databaseContext, stagingArea, current, 0) | |||
isNotFoundError := database.IsNotFoundError(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.
Maybe rename isNotFoundError
to isNonTrustedBlock
@@ -45,6 +67,37 @@ func (dtm *dagTraversalManager) calculateBlockWindowHeap(stagingArea *model.Stag | |||
return nil, 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.
Explain in a comment why blocks which are with trusted data should not use cache of selected parent (mergeset might be missing?)
|
||
if isNotFoundError && currentGHOSTDAGData.SelectedParent() != nil { | ||
windowHeapSlice, err := dtm.windowHeapSliceStore.Get(stagingArea, highHash, windowSize) | ||
isNotFoundError := database.IsNotFoundError(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.
Maybe rename isNotFoundError
to selectedParentNotCached
} | ||
|
||
if isNotFoundError && currentGHOSTDAGData.SelectedParent() != nil { | ||
windowHeapSlice, err := dtm.windowHeapSliceStore.Get(stagingArea, highHash, windowSize) |
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.
Seems like highHash
is an error, shouldn't it be currentGHOSTDAGData.SelectedParent()
? (the comment two lines below assumes that as well)
func (dtm *dagTraversalManager) blockWindowHeap(stagingArea *model.StagingArea, | ||
highHash *externalapi.DomainHash, windowSize int) (*sizedUpBlockHeap, error) { | ||
windowHeapSlice, err := dtm.windowHeapSliceStore.Get(stagingArea, highHash, windowSize) | ||
isNotFoundError := database.IsNotFoundError(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.
Perhaps rename isNotFoundError
to sliceNotCached
. In general the name isNotFoundError
is confusing also in the method below, I would avoid it
No description provided.