ethclient: simplify error handling in TransactionReceipt #28748 (#1384)

This commit is contained in:
Daniel Liu 2025-08-28 18:54:48 +08:00 committed by GitHub
parent d138eb22a3
commit f49d90eb69
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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.ErrNotFound
}
if err == nil && r == nil {
return nil, ethereum.ErrNotFound
}
return r, err
}