Skip to content

Commit

Permalink
fix for parent hash in stage batches (#170)
Browse files Browse the repository at this point in the history
  • Loading branch information
hexoscott committed Mar 5, 2024
1 parent bc50d2d commit d1e6ee6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions zk/stages/stage_batches.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,12 +213,12 @@ func SpawnStageBatches(
if lastHash != emptyHash {
l2Block.ParentHash = lastHash
} else {
// block 1 so get genesis detail
genesisHash, err := eriDb.ReadCanonicalHash(0)
// first block in the loop so read the parent hash
previousHash, err := eriDb.ReadCanonicalHash(l2Block.L2BlockNumber - 1)
if err != nil {
return fmt.Errorf("failed to get genesis header: %v", err)
}
l2Block.ParentHash = genesisHash
l2Block.ParentHash = previousHash
}

if err := writeL2Block(eriDb, hermezDb, &l2Block); err != nil {
Expand Down

0 comments on commit d1e6ee6

Please sign in to comment.