@@ -88,7 +88,7 @@ func NewExecutor(newSyncFunc NewSyncerFunc, config *Config, tmPubKey crypto.PubK
8888 return nil , err
8989 }
9090
91- l2Client := types .NewRetryableClient (laClient , leClient , aClient , eClient , config .MptTime , config .Logger )
91+ l2Client := types .NewRetryableClient (laClient , leClient , aClient , eClient , config .L2Legacy . EthAddr , config .Logger )
9292 index , err := getNextL1MsgIndex (l2Client )
9393 if err != nil {
9494 return nil , err
@@ -289,10 +289,26 @@ func (e *Executor) DeliverBlock(txs [][]byte, metaData []byte, consensusData l2n
289289 // Even if block was already delivered (e.g., synced via P2P), we still need to check
290290 // if MPT switch should happen, otherwise sentry nodes won't switch to the correct geth.
291291 e .l2Client .EnsureSwitched (context .Background (), wrappedBlock .Timestamp , wrappedBlock .Number )
292- if e .devSequencer {
293- return nil , consensusData .ValidatorSet , nil
292+
293+ // After switch, re-check height from the new geth client
294+ // The block might exist in legacy geth but not in target geth after switch
295+ newHeight , err := e .l2Client .BlockNumber (context .Background ())
296+ if err != nil {
297+ return nil , nil , err
298+ }
299+ if wrappedBlock .Number > newHeight {
300+ e .logger .Info ("block not in target geth after switch, need to deliver" ,
301+ "block_number" , wrappedBlock .Number ,
302+ "old_height" , height ,
303+ "new_height" , newHeight )
304+ // Update height and continue to deliver the block
305+ height = newHeight
306+ } else {
307+ if e .devSequencer {
308+ return nil , consensusData .ValidatorSet , nil
309+ }
310+ return e .getParamsAndValsAtHeight (int64 (wrappedBlock .Number ))
294311 }
295- return e .getParamsAndValsAtHeight (int64 (wrappedBlock .Number ))
296312 }
297313
298314 // We only accept the continuous blocks for now.
0 commit comments