Skip to content

Commit

Permalink
internal/ethapi: fix eth_call crash
Browse files Browse the repository at this point in the history
  • Loading branch information
gzliudan committed Jul 22, 2024
1 parent 83f4c89 commit 2b21070
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions internal/ethapi/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -1305,6 +1305,9 @@ func DoCall(ctx context.Context, b Backend, args CallArgs, blockNrOrHash rpc.Blo
if statedb == nil || err != nil {
return nil, 0, false, err, nil
}
if header == nil {
return nil, 0, false, errors.New("nil header in DoCall"), nil
}
if err := overrides.Apply(statedb); err != nil {
return nil, 0, false, err, nil
}
Expand All @@ -1327,6 +1330,9 @@ func DoCall(ctx context.Context, b Backend, args CallArgs, blockNrOrHash rpc.Blo
if err != nil {
return nil, 0, false, err, nil
}
if block == nil {
return nil, 0, false, fmt.Errorf("nil block in DoCall: number=%d, hash=%s", header.Number.Uint64(), header.Hash().Hex()), nil
}
author, err := b.GetEngine().Author(block.Header())
if err != nil {
return nil, 0, false, err, nil
Expand Down

0 comments on commit 2b21070

Please sign in to comment.