mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-22 12:46:44 +00:00
This commit is contained in:
parent
2726509176
commit
819318bd7a
1 changed files with 7 additions and 6 deletions
|
|
@ -238,13 +238,14 @@ 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) {
|
func (ec *Client) TransactionInBlock(ctx context.Context, blockHash common.Hash, index uint) (*types.Transaction, error) {
|
||||||
var json *rpcTransaction
|
var json *rpcTransaction
|
||||||
err := ec.c.CallContext(ctx, &json, "eth_getTransactionByBlockHashAndIndex", blockHash, hexutil.Uint64(index))
|
err := ec.c.CallContext(ctx, &json, "eth_getTransactionByBlockHashAndIndex", blockHash, hexutil.Uint64(index))
|
||||||
if err == nil {
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
if json == nil {
|
if json == nil {
|
||||||
return nil, ethereum.ErrNotFound
|
return nil, ethereum.ErrNotFound
|
||||||
} else if _, r, _ := json.tx.RawSignatureValues(); r == nil {
|
} else if _, r, _ := json.tx.RawSignatureValues(); r == nil {
|
||||||
return nil, errors.New("server returned transaction without signature")
|
return nil, errors.New("server returned transaction without signature")
|
||||||
}
|
}
|
||||||
}
|
|
||||||
setSenderFromServer(json.tx, json.From, json.BlockHash)
|
setSenderFromServer(json.tx, json.From, json.BlockHash)
|
||||||
return json.tx, err
|
return json.tx, err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue