ethclient: simplify error handling in TransactionReceipt (#28748)

Co-authored-by: Martin HS <martin@swende.se>
Co-authored-by: Felix Lange <fjl@twurst.com>
pull/28762/head
Rossen Krastev 11 months ago committed by GitHub
parent 99eb49e601
commit e3eeb64c94
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      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) { func (ec *Client) TransactionReceipt(ctx context.Context, txHash common.Hash) (*types.Receipt, error) {
var r *types.Receipt var r *types.Receipt
err := ec.c.CallContext(ctx, &r, "eth_getTransactionReceipt", txHash) err := ec.c.CallContext(ctx, &r, "eth_getTransactionReceipt", txHash)
if err == nil { if err == nil && r == nil {
if r == nil { return nil, ethereum.NotFound
return nil, ethereum.NotFound
}
} }
return r, err return r, err
} }

Loading…
Cancel
Save