Skip to content

Commit 85fb736

Browse files
committed
syncer: Only relay peer's tip after syncing
1 parent 49aa869 commit 85fb736

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

syncer/syncer.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -717,11 +717,11 @@ func (s *Syncer) syncLoop(ctx context.Context) error {
717717
if err := s.parallelSync(ctx, r.cs, r.headers); err != nil {
718718
s.log.Debug("sync failed", zap.Stringer("peer", r.peer), zap.Error(err))
719719
} else if r.remaining == 0 {
720-
// peer sent all their headers; mark as synced to avoid
721-
// re-downloading the same blocks over and over again
720+
// peer sent all their headers; mark them as synced and
721+
// relay their tip
722722
r.peer.setSynced(true)
723+
go s.relayV2Header(r.headers[len(r.headers)-1], r.peer)
723724
}
724-
go s.relayV2Header(r.headers[len(r.headers)-1], r.peer)
725725
}
726726
}
727727
}

0 commit comments

Comments
 (0)