Skip to content

Commit

Permalink
added a check
Browse files Browse the repository at this point in the history
  • Loading branch information
colinlyguo committed Aug 20, 2024
1 parent ba4f61c commit 2bd9438
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions coordinator/internal/logic/provertask/batch_prover_task.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,10 @@ func (bp *BatchProverTask) getBatchTaskDetail(ctx context.Context, dbBatch *orm.
chunks[i] = &encoding.Chunk{Blocks: blocks}
}

if dbBatch.Index == 0 {
return nil, fmt.Errorf("unexpected case: batch index should not be 0, i.e. genesis batch should have codec version 0")
}

dbParentBatch, getErr := bp.batchOrm.GetBatchByIndex(ctx, dbBatch.Index-1)
if getErr != nil {
return nil, fmt.Errorf("failed to get parent batch header for batch %d: %w", dbBatch.Index, getErr)
Expand Down

0 comments on commit 2bd9438

Please sign in to comment.