Skip to content

Commit 60e27b5

Browse files
mcdeefjl
authored andcommitted
ethclient: fix TransactionByHash pending return value. (ethereum#14663)
As per ethereum#14661 TransactionByHash always returns false for pending. This uses blockNumber rather than blockHash to ensure that it returns the correct value for pending and will not suffer side-effects if eth_getTransactionByHash is fixed in future.
1 parent 693d9cc commit 60e27b5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

ethclient/ethclient.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,11 +167,11 @@ func (ec *Client) TransactionByHash(ctx context.Context, hash common.Hash) (tx *
167167
} else if _, r, _ := tx.RawSignatureValues(); r == nil {
168168
return nil, false, fmt.Errorf("server returned transaction without signature")
169169
}
170-
var block struct{ BlockHash *common.Hash }
170+
var block struct{ BlockNumber *string }
171171
if err := json.Unmarshal(raw, &block); err != nil {
172172
return nil, false, err
173173
}
174-
return tx, block.BlockHash == nil, nil
174+
return tx, block.BlockNumber == nil, nil
175175
}
176176

177177
// TransactionCount returns the total number of transactions in the given block.

0 commit comments

Comments
 (0)