RPC: fix nil pointer on error

This commit is contained in:
alex.sharov 2021-10-20 07:28:14 +07:00
parent e90dd3eb41
commit bc5c09f5fc

View File

@ -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)}})