Skip to content

Commit

Permalink
prevent nil memory access by checking tx status before fetching recei…
Browse files Browse the repository at this point in the history
…pt (#130)
  • Loading branch information
beer-1 authored Dec 9, 2024
1 parent 55ab7cf commit 05f54b7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions jsonrpc/backend/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,8 @@ func (b *JSONRPCBackend) GetTransactionReceipt(hash common.Hash) (map[string]int
rpcTx, err := b.getTransaction(hash)
if err != nil {
return nil, err
} else if rpcTx == nil {
return nil, nil // tx is not found
} else if rpcTx == nil || rpcTx.BlockNumber == nil || rpcTx.BlockNumber.ToInt() == nil {
return nil, nil // tx is not found or in pending/queued state
}

receipt, err := b.getReceipt(hash)
Expand Down

0 comments on commit 05f54b7

Please sign in to comment.