From dd47dfdf0910515dc9703ca0236c837cb4f495c7 Mon Sep 17 00:00:00 2001 From: Enrique Jose Avila Asapche Date: Mon, 7 Mar 2022 03:24:21 +0000 Subject: [PATCH] typo and code consistency (#3651) --- cmd/rpcdaemon/commands/eth_txs.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/cmd/rpcdaemon/commands/eth_txs.go b/cmd/rpcdaemon/commands/eth_txs.go index 2396d11a9..2cf26862d 100644 --- a/cmd/rpcdaemon/commands/eth_txs.go +++ b/cmd/rpcdaemon/commands/eth_txs.go @@ -58,10 +58,13 @@ func (api *APIImpl) GetTransactionByHash(ctx context.Context, hash common.Hash) baseFee = block.BaseFee() } - if txn != nil { - return newRPCTransaction(txn, blockHash, blockNum, txnIndex, baseFee), nil + // if no transaction was found then we return nil + if txn == nil { + return nil, nil + } - return nil, nil + + return newRPCTransaction(txn, blockHash, blockNum, txnIndex, baseFee), nil } curHeader := rawdb.ReadCurrentHeader(tx) @@ -81,7 +84,7 @@ func (api *APIImpl) GetTransactionByHash(ctx context.Context, hash common.Hash) return nil, err } - // if no transactiion was found in the txpool then we return nil and an error warning that we didn't find the transaction by the hash + // if no transaction was found in the txpool then we return nil and an error warning that we didn't find the transaction by the hash if txn == nil { return nil, nil }