Commit b81df0e6 authored by protolambda's avatar protolambda

op-node: sanity check l1Blocks length, fix import

parent 1267badd
...@@ -79,6 +79,9 @@ func (bq *BatchQueue) popNextBatch(safeL2Head eth.L2BlockRef) *SingularBatch { ...@@ -79,6 +79,9 @@ func (bq *BatchQueue) popNextBatch(safeL2Head eth.L2BlockRef) *SingularBatch {
} }
func (bq *BatchQueue) advanceEpochMaybe(nextBatch *SingularBatch) { func (bq *BatchQueue) advanceEpochMaybe(nextBatch *SingularBatch) {
if len(bq.l1Blocks) == 0 {
return
}
if nextBatch.GetEpochNum() == rollup.Epoch(bq.l1Blocks[0].Number)+1 { if nextBatch.GetEpochNum() == rollup.Epoch(bq.l1Blocks[0].Number)+1 {
// Advance epoch if necessary // Advance epoch if necessary
bq.l1Blocks = bq.l1Blocks[1:] bq.l1Blocks = bq.l1Blocks[1:]
......
...@@ -9,10 +9,9 @@ import ( ...@@ -9,10 +9,9 @@ import (
"math/rand" "math/rand"
"testing" "testing"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil" "github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/log"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
......
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