@@ -130,9 +130,9 @@ func (c *Sequencer) GetNextBatch(ctx context.Context, req coresequencer.GetNextB
130130 return nil , ErrInvalidId
131131 }
132132
133- currentDAHeight := c .daHeight . Load ()
133+ currentDAHeight := c .GetDAHeight ()
134134
135- forcedEvent , err := c .fiRetriever .RetrieveForcedIncludedTxs (ctx , currentDAHeight )
135+ forcedTxsEvent , err := c .fiRetriever .RetrieveForcedIncludedTxs (ctx , currentDAHeight )
136136 if err != nil {
137137 if errors .Is (err , coreda .ErrHeightFromFuture ) {
138138 c .logger .Debug ().
@@ -143,25 +143,27 @@ func (c *Sequencer) GetNextBatch(ctx context.Context, req coresequencer.GetNextB
143143 }
144144
145145 // Still create an empty forced inclusion event
146- forcedEvent = & block.ForcedInclusionEvent {
146+ forcedTxsEvent = & block.ForcedInclusionEvent {
147147 Txs : [][]byte {},
148148 StartDaHeight : currentDAHeight ,
149149 EndDaHeight : currentDAHeight ,
150150 }
151151 }
152152
153153 // Always try to process forced inclusion transactions (including pending from previous epochs)
154- forcedTxs := c .processForcedInclusionTxs (forcedEvent , req .MaxBytes )
155- if forcedEvent .EndDaHeight > currentDAHeight {
156- c .SetDAHeight (forcedEvent .EndDaHeight )
157- } else if forcedEvent .StartDaHeight > currentDAHeight {
158- c .SetDAHeight (forcedEvent .StartDaHeight )
154+ forcedTxs := c .processForcedInclusionTxs (forcedTxsEvent , req .MaxBytes )
155+
156+ // Update DA height.
157+ // If we are in between epochs, we still need to bump the da height.
158+ // At the end of an epoch, we need to bump to go to the next epoch.
159+ if forcedTxsEvent .EndDaHeight >= currentDAHeight {
160+ c .SetDAHeight (forcedTxsEvent .EndDaHeight + 1 )
159161 }
160162
161163 c .logger .Debug ().
162164 Int ("tx_count" , len (forcedTxs )).
163- Uint64 ("da_height_start" , forcedEvent .StartDaHeight ).
164- Uint64 ("da_height_end" , forcedEvent .EndDaHeight ).
165+ Uint64 ("da_height_start" , forcedTxsEvent .StartDaHeight ).
166+ Uint64 ("da_height_end" , forcedTxsEvent .EndDaHeight ).
165167 Msg ("retrieved forced inclusion transactions from DA" )
166168
167169 // Calculate size used by forced inclusion transactions
0 commit comments