File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -354,11 +354,16 @@ func (s *Syncer) initializeState() error {
354354 }
355355
356356 // Set DA height to the maximum of the genesis start height, the state's DA height, and the cached DA height.
357- // The cache's DaHeight() is initialized from store metadata, so it's always correct even after cache clear.
358- // Only use cache.DaHeight() when P2P is actively syncing (headerStore has higher height than current state) .
357+ // Use the DA height from the last executed block instead of the maximum from all blocks,
358+ // because P2P-fetched heights may be lost on restart .
359359 daHeight := max (s .genesis .DAStartHeight , min (state .DAHeight - 1 , 0 ))
360- if s .headerStore != nil && s .headerStore .Height () > state .LastBlockHeight {
361- daHeight = max (daHeight , s .cache .DaHeight ())
360+ if state .LastBlockHeight > 0 {
361+ if lastHeaderDA , ok := s .cache .GetHeaderDAIncludedByHeight (state .LastBlockHeight ); ok {
362+ daHeight = max (daHeight , lastHeaderDA )
363+ }
364+ if lastDataDA , ok := s .cache .GetDataDAIncludedByHeight (state .LastBlockHeight ); ok {
365+ daHeight = max (daHeight , lastDataDA )
366+ }
362367 }
363368 s .daRetrieverHeight .Store (daHeight )
364369
You can’t perform that action at this time.
0 commit comments