From e9971d356bf977d2a3f63e50296d7410ade2d075 Mon Sep 17 00:00:00 2001 From: rhaps107 Date: Thu, 14 Dec 2017 15:24:34 +0300 Subject: [PATCH] internal/ethapi: don't crash for missing receipts Fixes #15408 Fixes #14432 --- internal/ethapi/api.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/internal/ethapi/api.go b/internal/ethapi/api.go index fe0ed81707..76a7306e41 100644 --- a/internal/ethapi/api.go +++ b/internal/ethapi/api.go @@ -1003,9 +1003,12 @@ func (s *PublicTransactionPoolAPI) GetRawTransactionByHash(ctx context.Context, func (s *PublicTransactionPoolAPI) GetTransactionReceipt(hash common.Hash) (map[string]interface{}, error) { tx, blockHash, blockNumber, index := core.GetTransaction(s.b.ChainDb(), hash) if tx == nil { - return nil, nil + return nil, errors.New("unknown transaction") } receipt, _, _, _ := core.GetReceipt(s.b.ChainDb(), hash) // Old receipts don't have the lookup data available + if receipt == nil { + return nil, errors.New("unknown receipt") + } var signer types.Signer = types.FrontierSigner{} if tx.Protected() {