Skip to content
This repository was archived by the owner on Feb 17, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions sequencer/closingsignalsmanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ func (c *closingSignalsManager) checkGERUpdate() {
func (c *closingSignalsManager) checkForcedBatches() {
for {
time.Sleep(c.cfg.ClosingSignalsManagerWaitForL1OperationsInSec.Duration)
log.Debug(time.Now())

latestSentForcedBatchNumber, err := c.dbManager.GetLastTrustedForcedBatchNumber(c.ctx, nil)
if err != nil {
Expand Down
15 changes: 14 additions & 1 deletion sequencer/finalizer.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,11 @@ func (f *finalizer) listenForClosingSignals(ctx context.Context) {
// Forced batch ch
case fb := <-f.closingSignalCh.ForcedBatchCh:
f.nextForcedBatchesMux.Lock()
f.nextForcedBatches = append(f.nextForcedBatches, fb) // TODO: change insert sort if not exists

if !containsForcedBatch(f.nextForcedBatches, fb) {
f.nextForcedBatches = append(f.nextForcedBatches, fb) // TODO: change insert sort if not exists
}

if f.nextForcedBatchDeadline == 0 {
f.setNextForcedBatchDeadline()
}
Expand Down Expand Up @@ -180,6 +184,15 @@ func (f *finalizer) listenForClosingSignals(ctx context.Context) {
}
}

func containsForcedBatch(nextForcedBatches []state.ForcedBatch, fb state.ForcedBatch) bool {
for _, f := range nextForcedBatches {
if f.ForcedBatchNumber == fb.ForcedBatchNumber {
return true
}
}
return false
}

// finalizeBatches runs the endless loop for processing transactions finalizing batches.
func (f *finalizer) finalizeBatches(ctx context.Context) {
for {
Expand Down
2 changes: 1 addition & 1 deletion state/pgstatestorage.go
Original file line number Diff line number Diff line change
Expand Up @@ -782,7 +782,7 @@ func scanForcedBatch(row pgx.Row) (ForcedBatch, error) {
coinbaseStr string
)
if err := row.Scan(
&forcedBatch.BlockNumber,
&forcedBatch.ForcedBatchNumber,
&gerStr,
&forcedBatch.ForcedAt,
&forcedBatch.RawTxsData,
Expand Down