From f274562c92171b83a8f0117eba2e821aa4872725 Mon Sep 17 00:00:00 2001 From: Victor Shyba Date: Tue, 25 Jan 2022 17:00:37 -0300 Subject: [PATCH] dont probe and ignore bad peers --- lbry/dht/protocol/iterative_find.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lbry/dht/protocol/iterative_find.py b/lbry/dht/protocol/iterative_find.py index f8bd2ba6b..117755797 100644 --- a/lbry/dht/protocol/iterative_find.py +++ b/lbry/dht/protocol/iterative_find.py @@ -142,6 +142,8 @@ class IterativeFinder: return not self.closest_peer or self.distance.is_closer(peer.node_id, self.closest_peer.node_id) def _add_active(self, peer): + if self.peer_manager.peer_is_good(peer) is False: + return if peer not in self.active and peer.node_id and peer.node_id != self.protocol.node_id: self.active.add(peer) if self._is_closer(peer): @@ -193,6 +195,9 @@ class IterativeFinder: continue if origin_address == (self.protocol.external_ip, self.protocol.udp_port): continue + if self.peer_manager.peer_is_good(peer) is False: + self.active.discard(peer) + continue self._schedule_probe(peer) added += 1 log.debug("running %d probes for key %s", len(self.running_probes), self.key.hex()[:8])