-
Notifications
You must be signed in to change notification settings - Fork 260
refactor: remove unnecessary usage of lru #3204
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 11 commits
7ca8de2
1911eb9
b1193fa
dbdd2cc
5ec8178
e5aae15
37ee626
44d8d60
9180a15
5d28492
240a0dd
b580bc5
b619b09
df4d8a3
48c735e
dad4eb2
952339c
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 |
|---|---|---|
|
|
@@ -354,16 +354,11 @@ func (s *Syncer) initializeState() error { | |
| } | ||
|
|
||
| // Set DA height to the maximum of the genesis start height, the state's DA height, and the cached DA height. | ||
| // Use the DA height from the last executed block instead of the maximum from all blocks, | ||
| // because P2P-fetched heights may be lost on restart. | ||
| // The cache's DaHeight() is initialized from store metadata, so it's always correct even after cache clear. | ||
| // Only use cache.DaHeight() when P2P is actively syncing (headerStore has higher height than current state). | ||
| daHeight := max(s.genesis.DAStartHeight, min(state.DAHeight-1, 0)) | ||
| if state.LastBlockHeight > 0 { | ||
| if lastHeaderDA, ok := s.cache.GetHeaderDAIncludedByHeight(state.LastBlockHeight); ok { | ||
| daHeight = max(daHeight, lastHeaderDA) | ||
| } | ||
| if lastDataDA, ok := s.cache.GetDataDAIncludedByHeight(state.LastBlockHeight); ok { | ||
| daHeight = max(daHeight, lastDataDA) | ||
| } | ||
| if s.headerStore != nil && s.headerStore.Height() > state.LastBlockHeight { | ||
| daHeight = max(daHeight, s.cache.DaHeight()) | ||
| } | ||
|
Comment on lines
356
to
365
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. Resume from the last applied block's DA height, not the cache-wide max.
🛠️ Safer resume logic- if s.headerStore != nil && s.headerStore.Height() > state.LastBlockHeight {
- daHeight = max(daHeight, s.cache.DaHeight())
- }
+ if s.headerStore != nil && s.headerStore.Height() > state.LastBlockHeight {
+ if headerDAHeight, ok := s.cache.GetHeaderDAIncludedByHeight(state.LastBlockHeight); ok {
+ daHeight = max(daHeight, headerDAHeight)
+ }
+ if dataDAHeight, ok := s.cache.GetDataDAIncludedByHeight(state.LastBlockHeight); ok {
+ daHeight = max(daHeight, dataDAHeight)
+ }
+ }🤖 Prompt for AI Agents |
||
| s.daRetrieverHeight.Store(daHeight) | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.