mirror of
				https://source.quilibrium.com/quilibrium/ceremonyclient.git
				synced 2025-11-04 06:59:41 +00:00 
			
		
		
		
	fix: filter out peers that didn't pass the bandwidth/manifest test
This commit is contained in:
		
							parent
							
								
									5a3af70dc8
								
							
						
					
					
						commit
						0e089d5899
					
				@ -170,6 +170,12 @@ func (e *CeremonyDataClockConsensusEngine) GetMostAheadPeer(
 | 
				
			|||||||
		if v.maxFrame > max &&
 | 
							if v.maxFrame > max &&
 | 
				
			||||||
			v.timestamp > config.GetMinimumVersionCutoff().UnixMilli() &&
 | 
								v.timestamp > config.GetMinimumVersionCutoff().UnixMilli() &&
 | 
				
			||||||
			bytes.Compare(v.version, config.GetMinimumVersion()) >= 0 && !ok {
 | 
								bytes.Compare(v.version, config.GetMinimumVersion()) >= 0 && !ok {
 | 
				
			||||||
 | 
								manifest := e.peerInfoManager.GetPeerInfo(v.peerId)
 | 
				
			||||||
 | 
								if manifest == nil || manifest.Bandwidth == 0 {
 | 
				
			||||||
 | 
									e.logger.Debug("peer manifest not found or bandwidth zero")
 | 
				
			||||||
 | 
									continue
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			peer = v.peerId
 | 
								peer = v.peerId
 | 
				
			||||||
			max = v.maxFrame
 | 
								max = v.maxFrame
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
@ -192,7 +198,7 @@ func (e *CeremonyDataClockConsensusEngine) sync(
 | 
				
			|||||||
	e.logger.Info("polling peer for new frames", zap.Binary("peer_id", peerId))
 | 
						e.logger.Info("polling peer for new frames", zap.Binary("peer_id", peerId))
 | 
				
			||||||
	cc, err := e.pubSub.GetDirectChannel(peerId, "")
 | 
						cc, err := e.pubSub.GetDirectChannel(peerId, "")
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		e.logger.Error(
 | 
							e.logger.Debug(
 | 
				
			||||||
			"could not establish direct channel",
 | 
								"could not establish direct channel",
 | 
				
			||||||
			zap.Error(err),
 | 
								zap.Error(err),
 | 
				
			||||||
		)
 | 
							)
 | 
				
			||||||
@ -216,7 +222,7 @@ func (e *CeremonyDataClockConsensusEngine) sync(
 | 
				
			|||||||
		grpc.MaxCallRecvMsgSize(600*1024*1024),
 | 
							grpc.MaxCallRecvMsgSize(600*1024*1024),
 | 
				
			||||||
	)
 | 
						)
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		e.logger.Error(
 | 
							e.logger.Debug(
 | 
				
			||||||
			"could not get frame",
 | 
								"could not get frame",
 | 
				
			||||||
			zap.Error(err),
 | 
								zap.Error(err),
 | 
				
			||||||
		)
 | 
							)
 | 
				
			||||||
@ -234,7 +240,7 @@ func (e *CeremonyDataClockConsensusEngine) sync(
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if response == nil {
 | 
						if response == nil {
 | 
				
			||||||
		e.logger.Error("received no response from peer")
 | 
							e.logger.Debug("received no response from peer")
 | 
				
			||||||
		if err := cc.Close(); err != nil {
 | 
							if err := cc.Close(); err != nil {
 | 
				
			||||||
			e.logger.Error("error while closing connection", zap.Error(err))
 | 
								e.logger.Error("error while closing connection", zap.Error(err))
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user