Skip to content

Commit

Permalink
Fix getBatchByNumber when prevBatch ger doesn't exist
Browse files Browse the repository at this point in the history
  • Loading branch information
cffls committed Jul 9, 2024
1 parent 529cb58 commit d515a87
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions cmd/rpcdaemon/commands/zkevm_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -645,15 +645,17 @@ func (api *ZkEvmAPIImpl) GetBatchByNumber(ctx context.Context, batchNumber rpc.B
return nil, err
}

itu, err := hermezDb.GetL1InfoTreeUpdateByGer(prevBatchGer.GlobalExitRoot)
if err != nil {
return nil, err
}
if prevBatchGer != nil {
itu, err := hermezDb.GetL1InfoTreeUpdateByGer(prevBatchGer.GlobalExitRoot)
if err != nil {
return nil, err
}

if itu == nil || batch.MainnetExitRoot == itu.MainnetExitRoot {
batch.MainnetExitRoot = common.Hash{}
batch.RollupExitRoot = common.Hash{}
batch.GlobalExitRoot = common.Hash{}
if itu == nil || batch.MainnetExitRoot == itu.MainnetExitRoot {
batch.MainnetExitRoot = common.Hash{}
batch.RollupExitRoot = common.Hash{}
batch.GlobalExitRoot = common.Hash{}
}
}
}

Expand Down

0 comments on commit d515a87

Please sign in to comment.