From e3eeb64c9424d599efc3d3f9cde1c64131f694aa Mon Sep 17 00:00:00 2001 From: Rossen Krastev Date: Thu, 4 Jan 2024 17:32:23 +0200 Subject: [PATCH] ethclient: simplify error handling in TransactionReceipt (#28748) Co-authored-by: Martin HS Co-authored-by: Felix Lange --- ethclient/ethclient.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/ethclient/ethclient.go b/ethclient/ethclient.go index e8a201f71b..900335988b 100644 --- a/ethclient/ethclient.go +++ b/ethclient/ethclient.go @@ -307,10 +307,8 @@ func (ec *Client) TransactionInBlock(ctx context.Context, blockHash common.Hash, func (ec *Client) TransactionReceipt(ctx context.Context, txHash common.Hash) (*types.Receipt, error) { var r *types.Receipt err := ec.c.CallContext(ctx, &r, "eth_getTransactionReceipt", txHash) - if err == nil { - if r == nil { - return nil, ethereum.NotFound - } + if err == nil && r == nil { + return nil, ethereum.NotFound } return r, err }