Skip to content

Commit

Permalink
Add check for empty contracts list
Browse files Browse the repository at this point in the history
  • Loading branch information
seanmcgary committed Dec 19, 2024
1 parent 70704f0 commit 341f451
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pkg/indexer/transactionLogs.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func (idx *Indexer) ParseTransactionLogs(
}

// if the contract is interesting but not found, throw an error to stop processing
if foundContracts == nil {
if foundContracts == nil || len(foundContracts) == 0 {
idx.Logger.Sugar().Errorw("No contract found for address", zap.String("hash", transaction.Hash.Value()))
return nil, NewIndexError(IndexError_FailedToFindContract, err).
WithMessage("No contract found for address").
Expand Down Expand Up @@ -184,8 +184,8 @@ func (idx *Indexer) DecodeLogWithAbi(
if err != nil {
return idx.DecodeLog(nil, lg)
}
if foundContracts == nil {
idx.Logger.Sugar().Debugw("No contract found for address", zap.String("address", logAddress.String()))
if foundContracts == nil || len(foundContracts) == 0 {
idx.Logger.Sugar().Errorw("No contract found for address", zap.String("address", logAddress.String()))
return idx.DecodeLog(nil, lg)
}

Expand Down

0 comments on commit 341f451

Please sign in to comment.