aboutsummaryrefslogtreecommitdiffstats
path: root/internal
diff options
context:
space:
mode:
authorrhaps107 <dod-source@yandex.ru>2017-12-14 20:24:34 +0800
committerFelix Lange <fjl@users.noreply.github.com>2017-12-14 20:24:34 +0800
commite9971d356bf977d2a3f63e50296d7410ade2d075 (patch)
treefb6446ed2f4bedd75771fc36a99406cab1f61be5 /internal
parent5129ef22c2aaa3e8c733fe7c0fb6eff64457426c (diff)
downloaddexon-e9971d356bf977d2a3f63e50296d7410ade2d075.tar.gz
dexon-e9971d356bf977d2a3f63e50296d7410ade2d075.tar.zst
dexon-e9971d356bf977d2a3f63e50296d7410ade2d075.zip
internal/ethapi: don't crash for missing receipts
Fixes #15408 Fixes #14432
Diffstat (limited to 'internal')
-rw-r--r--internal/ethapi/api.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/internal/ethapi/api.go b/internal/ethapi/api.go
index fe0ed8170..76a7306e4 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() {