mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-27 15:16:43 +00:00
ethclient: fix TransactionByHash()'s pending return value.
As per #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.
This commit is contained in:
parent
431cf2a1e4
commit
1998ae20a5
1 changed files with 2 additions and 2 deletions
|
|
@ -167,11 +167,11 @@ func (ec *Client) TransactionByHash(ctx context.Context, hash common.Hash) (tx *
|
|||
} else if _, r, _ := tx.RawSignatureValues(); r == nil {
|
||||
return nil, false, fmt.Errorf("server returned transaction without signature")
|
||||
}
|
||||
var block struct{ BlockHash *common.Hash }
|
||||
var block struct{ BlockNumber *string }
|
||||
if err := json.Unmarshal(raw, &block); err != nil {
|
||||
return nil, false, err
|
||||
}
|
||||
return tx, block.BlockHash == nil, nil
|
||||
return tx, block.BlockNumber == nil, nil
|
||||
}
|
||||
|
||||
// TransactionCount returns the total number of transactions in the given block.
|
||||
|
|
|
|||
Loading…
Reference in a new issue