From 341f451e05a8068acee840549dabbf36879ea7e1 Mon Sep 17 00:00:00 2001 From: Sean McGary Date: Thu, 19 Dec 2024 14:51:56 -0600 Subject: [PATCH] Add check for empty contracts list --- pkg/indexer/transactionLogs.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/indexer/transactionLogs.go b/pkg/indexer/transactionLogs.go index 59dc3fd8..efd9953d 100644 --- a/pkg/indexer/transactionLogs.go +++ b/pkg/indexer/transactionLogs.go @@ -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"). @@ -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) }