Skip to content

Commit

Permalink
Merge pull request #250 from uprendis/feature/fix-receipt-api-crash
Browse files Browse the repository at this point in the history
Fix nil pointer dereference in GetTransactionReceipt
  • Loading branch information
uprendis authored Feb 11, 2022
2 parents a3e301a + 3c63767 commit 7be62db
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions ethapi/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -1623,13 +1623,9 @@ func (s *PublicTransactionPoolAPI) GetTransactionReceipt(ctx context.Context, ha
"type": hexutil.Uint(tx.Type()),
}
// Assign the effective gas price paid
if !s.b.ChainConfig().IsLondon(bigblock) {
if header.BaseFee == nil {
fields["effectiveGasPrice"] = hexutil.Uint64(tx.GasPrice().Uint64())
} else {
header, err := s.b.HeaderByHash(ctx, header.Hash)
if err != nil {
return nil, err
}
gasPrice := new(big.Int).Add(header.BaseFee, tx.EffectiveGasTipValue(header.BaseFee))
fields["effectiveGasPrice"] = hexutil.Uint64(gasPrice.Uint64())
}
Expand Down

0 comments on commit 7be62db

Please sign in to comment.