From 3fcd77955e9a5caff56a27285febe22ac2f4ee77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Garamv=C3=B6lgyi?= Date: Tue, 21 Feb 2023 18:23:18 +0100 Subject: [PATCH] fix GetTransactionReceipt crash when BaseFee is missing (#224) --- internal/ethapi/api.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/internal/ethapi/api.go b/internal/ethapi/api.go index 29a7b05959..5e6302cb45 100644 --- a/internal/ethapi/api.go +++ b/internal/ethapi/api.go @@ -1588,7 +1588,13 @@ func (s *PublicTransactionPoolAPI) GetTransactionReceipt(ctx context.Context, ha if err != nil { 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()) } // Assign receipt status or post state.