Commit 1ee7e175 authored by Andrew Huang's avatar Andrew Huang

Cancel any inflight block building when stopping the sequencer, to avoid intermediate state.

parent 0bf53e73
...@@ -81,6 +81,7 @@ type SequencerIface interface { ...@@ -81,6 +81,7 @@ type SequencerIface interface {
PlanNextSequencerAction() time.Duration PlanNextSequencerAction() time.Duration
RunNextSequencerAction(ctx context.Context) (*eth.ExecutionPayload, error) RunNextSequencerAction(ctx context.Context) (*eth.ExecutionPayload, error)
BuildingOnto() eth.L2BlockRef BuildingOnto() eth.L2BlockRef
CancelBuildingBlock(ctx context.Context)
} }
type Network interface { type Network interface {
......
...@@ -381,6 +381,9 @@ func (s *Driver) eventLoop() { ...@@ -381,6 +381,9 @@ func (s *Driver) eventLoop() {
} }
s.log.Warn("Sequencer has been stopped") s.log.Warn("Sequencer has been stopped")
s.driverConfig.SequencerStopped = true s.driverConfig.SequencerStopped = true
// Cancel any inflight block building. If we don't cancel this, we can resume sequencing an old block
// even if we've received new unsafe heads in the interim, causing us to introduce a re-org.
s.sequencer.CancelBuildingBlock(ctx)
respCh <- hashAndError{hash: s.derivation.UnsafeL2Head().Hash} respCh <- hashAndError{hash: s.derivation.UnsafeL2Head().Hash}
} }
case respCh := <-s.sequencerActive: case respCh := <-s.sequencerActive:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment