Skip to content

Commit

Permalink
tbc: fix err logging in sync indexers (#325)
Browse files Browse the repository at this point in the history
* fix crawler.go error handling

* service/tbc: fix logging for syncing complete

---------

Co-authored-by: Joshua Sing <[email protected]>
  • Loading branch information
CodeDragonVN and joshuasing authored Nov 22, 2024
1 parent a9648ad commit 1ac37aa
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions service/tbc/crawler.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -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
}
Expand Down

0 comments on commit 1ac37aa

Please sign in to comment.