Skip to content

Commit e9971d3

Browse files
rhaps107fjl
authored andcommitted
internal/ethapi: don't crash for missing receipts
Fixes #15408 Fixes #14432
1 parent 5129ef2 commit e9971d3

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

‎internal/ethapi/api.go‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1003,9 +1003,12 @@ func (s *PublicTransactionPoolAPI) GetRawTransactionByHash(ctx context.Context,
10031003
func (s *PublicTransactionPoolAPI) GetTransactionReceipt(hash common.Hash) (map[string]interface{}, error) {
10041004
tx, blockHash, blockNumber, index := core.GetTransaction(s.b.ChainDb(), hash)
10051005
if tx == nil {
1006-
return nil, nil
1006+
return nil, errors.New("unknown transaction")
10071007
}
10081008
receipt, _, _, _ := core.GetReceipt(s.b.ChainDb(), hash) // Old receipts don't have the lookup data available
1009+
if receipt == nil {
1010+
return nil, errors.New("unknown receipt")
1011+
}
10091012

10101013
var signer types.Signer = types.FrontierSigner{}
10111014
if tx.Protected() {

0 commit comments

Comments
 (0)