From 038159e8e13084a00c623033fc09e5eb1983d493 Mon Sep 17 00:00:00 2001 From: bnoieh <135800952+bnoieh@users.noreply.github.com> Date: Fri, 1 Dec 2023 18:22:33 +0800 Subject: [PATCH] fix not do sequence action instantly --- op-node/rollup/driver/sequencer.go | 4 ++-- op-node/rollup/driver/state.go | 12 +----------- 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/op-node/rollup/driver/sequencer.go b/op-node/rollup/driver/sequencer.go index f57bd3c4c7..3d5b30aa0b 100644 --- a/op-node/rollup/driver/sequencer.go +++ b/op-node/rollup/driver/sequencer.go @@ -137,8 +137,8 @@ func (d *Sequencer) PlanNextSequencerAction() time.Duration { buildingOnto, buildingID, _ := d.engine.BuildingPayload() // We may have to wait till the next sequencing action, e.g. upon an error. - // Delay when sequencer action failed - if delay := d.nextAction.Sub(now); delay > 0 { + // If the head changed we need to respond and will not delay the sequencing. + if delay := d.nextAction.Sub(now); delay > 0 && buildingOnto.Hash == head.Hash { return delay } diff --git a/op-node/rollup/driver/state.go b/op-node/rollup/driver/state.go index c69810eb52..4b5df96b08 100644 --- a/op-node/rollup/driver/state.go +++ b/op-node/rollup/driver/state.go @@ -269,17 +269,7 @@ func (s *Driver) eventLoop() { // This may adjust at any time based on fork-choice changes or previous errors. // // update sequencer time if the head changed - delay := s.sequencer.PlanNextSequencerAction() - if delay == 0 { - // immediately do sequencerStep if time is ready - if err := sequencerStep(); err != nil { - return - } - // sequencerStep was already done, so we continue to next round - continue - } else { - planSequencerAction() - } + planSequencerAction() } } else { sequencerCh = nil