From ce92d320e34b0868ab98aae9e1227987296dc925 Mon Sep 17 00:00:00 2001 From: Tudor Malene Date: Thu, 14 Sep 2023 14:27:28 +0100 Subject: [PATCH] fix --- go/enclave/components/batch_registry.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/go/enclave/components/batch_registry.go b/go/enclave/components/batch_registry.go index e866ba3e32..225c06036e 100644 --- a/go/enclave/components/batch_registry.go +++ b/go/enclave/components/batch_registry.go @@ -116,11 +116,13 @@ func (br *batchRegistry) BatchesAfter(batchSeqNo uint64, upToL1Height uint64, ro currentBatchSeq++ } - // Sanity check that the rollup includes consecutive batches (according to the seqNo) - current := resultBatches[0].SeqNo().Uint64() - for i, b := range resultBatches { - if current+uint64(i) != b.SeqNo().Uint64() { - return nil, fmt.Errorf("created invalid rollup with batches out of sequence") + if len(resultBatches) > 0 { + // Sanity check that the rollup includes consecutive batches (according to the seqNo) + current := resultBatches[0].SeqNo().Uint64() + for i, b := range resultBatches { + if current+uint64(i) != b.SeqNo().Uint64() { + return nil, fmt.Errorf("created invalid rollup with batches out of sequence") + } } }