Skip to content

Commit

Permalink
returned error if error object is not nil (#4685)
Browse files Browse the repository at this point in the history
* returned error if error object is not nil

* undefined block: changed it to blockNumber
  • Loading branch information
leonardchinonso committed Jul 10, 2022
1 parent cfc0518 commit 8a75033
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions cmd/rpcdaemon/commands/eth_receipts.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,10 @@ func (api *APIImpl) GetLogs(ctx context.Context, crit filters.FilterCriteria) ([
}

body, err := api._blockReader.BodyWithTransactions(ctx, tx, blockHash, blockNumber)
if err != nil || body == nil {
if err != nil {
return nil, err
}
if body == nil {
return nil, fmt.Errorf("block not found %d", blockNumber)
}
for _, log := range blockLogs {
Expand All @@ -203,7 +206,7 @@ func (api *APIImpl) GetLogs(ctx context.Context, crit filters.FilterCriteria) ([
}
logs = append(logs, blockLogs...)

borLogs := rawdb.ReadBorReceiptLogs(tx, blockHash, block, txIndex+1, logIndex)
borLogs := rawdb.ReadBorReceiptLogs(tx, blockHash, blockNumber, txIndex+1, logIndex)
if borLogs != nil {
borLogs = filterLogs(borLogs, crit.Addresses, crit.Topics)
if len(borLogs) > 0 {
Expand Down

0 comments on commit 8a75033

Please sign in to comment.