fix GetTransactionReceipt crash when BaseFee is missing (#224)

This commit is contained in:
Péter Garamvölgyi 2023-02-21 18:23:18 +01:00 committed by GitHub
parent 310c870c6a
commit 3fcd77955e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1588,7 +1588,13 @@ func (s *PublicTransactionPoolAPI) GetTransactionReceipt(ctx context.Context, ha
if err != nil { if err != nil {
return nil, err return nil, err
} }
gasPrice := new(big.Int).Add(header.BaseFee, tx.EffectiveGasTipValue(header.BaseFee))
baseFee := header.BaseFee
if baseFee == nil {
baseFee = big.NewInt(0)
}
gasPrice := new(big.Int).Add(baseFee, tx.EffectiveGasTipValue(header.BaseFee))
fields["effectiveGasPrice"] = hexutil.Uint64(gasPrice.Uint64()) fields["effectiveGasPrice"] = hexutil.Uint64(gasPrice.Uint64())
} }
// Assign receipt status or post state. // Assign receipt status or post state.