8000 [Client] Added misconsidered error handling by hyunsooda · Pull Request #1932 · klaytn/klaytn · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
This repository was archived by the owner on Aug 19, 2024. It is now read-only.

[Client] Added misconsidered error handling #1932

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions client/klay_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,12 +225,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, "klay_getTransactionByBlockHashAndIndex", blockHash, hexutil.Uint64(index))
if err == nil {
if json == nil {
return nil, klaytn.NotFound
} else if sigs := json.tx.RawSignatureValues(); sigs[0].V == nil {
return nil, fmt.Errorf("server returned transaction without signature")
}
if err != nil {
return nil, err
}
if json == nil {
return nil, klaytn.NotFound
} else if sigs := json.tx.RawSignatureValues(); sigs[0].V == nil {
return nil, fmt.Errorf("server returned transaction without signature")
}
if json.From != nil && json.BlockHash != nil {
setSenderFromServer(json.tx, *json.From, *json.BlockHash)
Expand Down
0