@@ -96,9 +96,9 @@ func (sc *SyncCoordinator) isCaughtUp() bool {
9696 // Get all peers
9797 peers := sc .registry .GetAllPeers ()
9898
99- // Check if any peer is significantly ahead of us
99+ // Check if any peer is significantly ahead of us and has a good reputation
100100 for _ , p := range peers {
101- if p .Height > localHeight {
101+ if p .Height > localHeight && p . ReputationScore > 20 {
102102 return false // At least one peer is ahead
103103 }
104104 }
@@ -359,22 +359,22 @@ func (sc *SyncCoordinator) handleFSMTransition(currentState *blockchain_api.FSMS
359359 currentPeer , localHeight , peerInfo .Height )
360360
361361 // Record catchup failure for reputation tracking
362- if sc .registry != nil {
362+ /* if sc.registry != nil {
363363 // Get peer info to check failure count
364364 peerInfo, _ := sc.registry.GetPeer(currentPeer)
365365
366366 // If this peer has failed multiple times recently, treat as malicious
367367 // (likely on an invalid chain)
368368 if peerInfo.InteractionFailures > 2 &&
369- time .Since (peerInfo .LastInteractionFailure ) < 5 * time .Minute {
369+ time.Since(peerInfo.LastInteractionFailure) < 5*time.Minute {
370370 sc.registry.RecordMaliciousInteraction(currentPeer)
371371 sc.logger.Warnf("[SyncCoordinator] Peer %s has failed %d times recently, marking as potentially malicious",
372372 currentPeer, peerInfo.InteractionFailures)
373373 } else {
374374 sc.registry.RecordCatchupFailure(currentPeer)
375375 sc.logger.Infof("[SyncCoordinator] Recorded catchup failure for peer %s (reputation will decrease)", currentPeer)
376376 }
377- }
377+ }*/
378378
379379 sc .ClearSyncPeer ()
380380 _ = sc .TriggerSync ()
@@ -724,12 +724,12 @@ func (sc *SyncCoordinator) checkAllPeersAttempted() {
724724 for _ , p := range peers {
725725 // Count peers that would normally be eligible
726726 if p .Height > localHeight && p .IsHealthy && ! p .IsBanned &&
727- p .DataHubURL != "" && p .URLResponsive && p .ReputationScore >= 20 {
727+ p .DataHubURL != "" && p .URLResponsive && p .ReputationScore >= 20 {
728728 eligibleCount ++
729729
730730 // Check if attempted recently
731731 if ! p .LastSyncAttempt .IsZero () &&
732- time .Since (p .LastSyncAttempt ) < syncAttemptCooldown {
732+ time .Since (p .LastSyncAttempt ) < syncAttemptCooldown {
733733 recentlyAttemptedCount ++
734734 }
735735 }
0 commit comments