returned error if error object is not nil (#4685)

* returned error if error object is not nil

* undefined block: changed it to blockNumber
This commit is contained in:
Leonard Chinonso 2022-07-10 03:13:24 +01:00 committed by GitHub
parent cfc051892e
commit 8a75033b98
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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 {
@ -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 {