From bc5c09f5fc723763a8ecfab8a0260c60d73a9baa Mon Sep 17 00:00:00 2001 From: "alex.sharov" Date: Wed, 20 Oct 2021 07:28:14 +0700 Subject: [PATCH] RPC: fix nil pointer on error --- cmd/rpcdaemon/commands/eth_txs.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cmd/rpcdaemon/commands/eth_txs.go b/cmd/rpcdaemon/commands/eth_txs.go index 7f32150aa..b0683c3b5 100644 --- a/cmd/rpcdaemon/commands/eth_txs.go +++ b/cmd/rpcdaemon/commands/eth_txs.go @@ -50,6 +50,9 @@ func (api *APIImpl) GetTransactionByHash(ctx context.Context, hash common.Hash) } curHeader := rawdb.ReadCurrentHeader(tx) + if curHeader == nil { + return nil, nil + } // No finalized transaction, try to retrieve it from the pool reply, err := api.txPool.Transactions(ctx, &txpool.TransactionsRequest{Hashes: []*types.H256{gointerfaces.ConvertHashToH256(hash)}})