Skip to content

Commit

Permalink
delete all pending txs & processed msgs before stopping batch submitt…
Browse files Browse the repository at this point in the history
…er (#75)
  • Loading branch information
sh-cha authored Feb 6, 2025
1 parent cb1812c commit 4e3e5e4
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions executor/batchsubmitter/batch.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,15 @@ func (bs *BatchSubmitter) prepareBatch(blockHeight int64) error {
return errors.Wrap(err, "failed to set synced height")
}

err = node.DeleteProcessedMsgs(bs.da.DB())
if err != nil {
return errors.Wrap(err, "failed to delete processed msgs")
}
err = node.DeletePendingTxs(bs.da.DB())
if err != nil {
return errors.Wrap(err, "failed to delete pending txs")
}

// error will restart block process from nextBatchInfo.Output.L2BlockNumber + 1
panic(fmt.Errorf("batch info updated: reset from %d", nextBatchInfo.Output.L2BlockNumber))
}
Expand Down

0 comments on commit 4e3e5e4

Please sign in to comment.