From 1ac37aa6a962ee924f2d78f977466b15ddaa4658 Mon Sep 17 00:00:00 2001 From: CodeDragonVN <150457827+CodeDragonVN@users.noreply.github.com> Date: Fri, 22 Nov 2024 15:41:40 +0000 Subject: [PATCH] tbc: fix err logging in sync indexers (#325) * fix crawler.go error handling * service/tbc: fix logging for syncing complete --------- Co-authored-by: Joshua Sing --- service/tbc/crawler.go | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/service/tbc/crawler.go b/service/tbc/crawler.go index 3fe29a14..8f097ecc 100644 --- a/service/tbc/crawler.go +++ b/service/tbc/crawler.go @@ -1354,10 +1354,11 @@ func (s *Server) SyncIndexersToHash(ctx context.Context, hash *chainhash.Hash) e log.Debugf("Done syncing to: %v", hash) bh, err := s.db.BlockHeaderByHash(ctx, hash) - if err == nil { - return err + if err != nil { + log.Errorf("block header by hash: %v", err) + } else { + log.Infof("Syncing complete at: %v", bh.HH()) } - log.Infof("Syncing complete at: %v", bh.HH()) return nil } @@ -1442,10 +1443,11 @@ func (s *Server) syncIndexersToBest(ctx context.Context) error { } bh, err := s.db.BlockHeaderByHash(ctx, &bhb.Hash) - if err == nil { - return err + if err != nil { + log.Errorf("block header by hash: %v", err) + } else { + log.Infof("Syncing complete at: %v", bh.HH()) } - log.Infof("Syncing complete at: %v", bh.HH()) return nil }