aboutsummaryrefslogtreecommitdiffstats
path: root/ethclient/ethclient.go
diff options
context:
space:
mode:
Diffstat (limited to 'ethclient/ethclient.go')
-rw-r--r--ethclient/ethclient.go13
1 files changed, 7 insertions, 6 deletions
diff --git a/ethclient/ethclient.go b/ethclient/ethclient.go
index f3163e19b..aedf2814a 100644
--- a/ethclient/ethclient.go
+++ b/ethclient/ethclient.go
@@ -241,12 +241,13 @@ func (ec *Client) TransactionCount(ctx context.Context, blockHash common.Hash) (
func (ec *Client) TransactionInBlock(ctx context.Context, blockHash common.Hash, index uint) (*types.Transaction, error) {
var json *rpcTransaction
err := ec.c.CallContext(ctx, &json, "eth_getTransactionByBlockHashAndIndex", blockHash, hexutil.Uint64(index))
- if err == nil {
- if json == nil {
- return nil, ethereum.NotFound
- } else if _, r, _ := json.tx.RawSignatureValues(); r == nil {
- return nil, fmt.Errorf("server returned transaction without signature")
- }
+ if err != nil {
+ return nil, err
+ }
+ if json == nil {
+ return nil, ethereum.NotFound
+ } else if _, r, _ := json.tx.RawSignatureValues(); r == nil {
+ return nil, fmt.Errorf("server returned transaction without signature")
}
if json.From != nil && json.BlockHash != nil {
setSenderFromServer(json.tx, *json.From, *json.BlockHash)