From c43ae65bba95bb524cf11e91a4a65d6c67cb18af Mon Sep 17 00:00:00 2001
From: Alex Sharov <AskAlexSharov@gmail.com>
Date: Thu, 19 May 2022 20:03:58 +0700
Subject: [PATCH] Bor: GetTransactionReceipt (#4209)

---
 cmd/rpcdaemon/commands/eth_receipts.go | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/cmd/rpcdaemon/commands/eth_receipts.go b/cmd/rpcdaemon/commands/eth_receipts.go
index 3e5e3c1cf4..c9d3af633b 100644
--- a/cmd/rpcdaemon/commands/eth_receipts.go
+++ b/cmd/rpcdaemon/commands/eth_receipts.go
@@ -255,8 +255,12 @@ func (api *APIImpl) GetTransactionReceipt(ctx context.Context, hash common.Hash)
 		return nil, err
 	}
 
-	if chainConfig.Bor != nil {
-		if blockNum == 0 {
+	blockNum, ok, err = api.txnLookup(ctx, tx, hash)
+	if err != nil {
+		return nil, err
+	}
+	if !ok {
+		if chainConfig.Bor != nil {
 			var blocN uint64
 			borTx, blockHash, blocN, _, err = rawdb.ReadBorTransaction(tx, hash)
 			if err != nil {
@@ -266,13 +270,7 @@ func (api *APIImpl) GetTransactionReceipt(ctx context.Context, hash common.Hash)
 				return nil, nil // not error, see https://github.com/ledgerwatch/erigon/issues/1645
 			}
 			blockNum = blocN
-		}
-	} else {
-		blockNum, ok, err = api.txnLookup(ctx, tx, hash)
-		if err != nil {
-			return nil, err
-		}
-		if !ok {
+		} else {
 			return nil, nil // not error, see https://github.com/ledgerwatch/erigon/issues/1645
 		}
 	}
-- 
GitLab