diff --git a/proxy/grpc/server.go b/proxy/grpc/server.go index 7be1747..18af360 100644 --- a/proxy/grpc/server.go +++ b/proxy/grpc/server.go @@ -59,9 +59,6 @@ func (s *proxyOutputSrv) GetNextBatch(ctx context.Context, req *pbseq.Batch) (*p if err != nil { return nil, err } - if batch == nil { - return nil, nil - } return batch.ToProto(), nil } diff --git a/test/dummy.go b/test/dummy.go index 335cfb1..276f736 100644 --- a/test/dummy.go +++ b/test/dummy.go @@ -39,10 +39,6 @@ func (tq *TransactionQueue) GetNextBatch() *sequencing.Batch { defer tq.mu.Unlock() size := len(tq.queue) - if size == 0 { - return nil - } - batch := tq.queue[:size] tq.queue = tq.queue[size:] return &sequencing.Batch{Transactions: batch} @@ -90,8 +86,9 @@ func (d *DummySequencer) GetNextBatch(ctx context.Context, lastBatch *sequencing } batch := d.tq.GetNextBatch() - if batch == nil { - return nil, nil + // If there are no transactions, return empty batch without updating the last batch hash + if batch.Transactions == nil { + return batch, nil } batchBytes, err := batch.Marshal()