Skip to content

Commit

Permalink
proper error handling for not found scenarios
Browse files Browse the repository at this point in the history
  • Loading branch information
lucca30 committed Jan 13, 2025
1 parent 3582958 commit 31e7d4a
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions internal/ethapi/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import (
"github.com/davecgh/go-spew/spew"
"github.com/tyler-smith/go-bip39"

"github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/accounts"
"github.com/ethereum/go-ethereum/accounts/keystore"
"github.com/ethereum/go-ethereum/accounts/scwallet"
Expand Down Expand Up @@ -705,7 +706,7 @@ func (api *BlockChainAPI) GetTransactionReceiptsByBlock(ctx context.Context, blo
var txHash common.Hash

borReceipt, err := api.b.GetBorBlockReceipt(ctx, block.Hash())
if err != nil {
if err != nil && err != ethereum.NotFound {
return nil, err
}
if borReceipt != nil {
Expand Down Expand Up @@ -1119,7 +1120,7 @@ func (api *BlockChainAPI) GetBlockReceipts(ctx context.Context, blockNrOrHash rp
}

stateSyncReceipt, err := api.b.GetBorBlockReceipt(ctx, block.Hash())
if err != nil {
if err != nil && err != ethereum.NotFound {
return nil, err
}
if stateSyncReceipt != nil {
Expand Down Expand Up @@ -2096,7 +2097,7 @@ func (api *TransactionAPI) GetTransactionReceipt(ctx context.Context, hash commo
if borTx {
// Fetch bor block receipt
receipt, err = api.b.GetBorBlockReceipt(ctx, blockHash)
if err != nil {
if err != nil && err != ethereum.NotFound {
return nil, err
}
} else {
Expand Down

0 comments on commit 31e7d4a

Please sign in to comment.