diff --git a/src/tribler-core/tribler_core/modules/dht_health_manager.py b/src/tribler-core/tribler_core/modules/dht_health_manager.py index acf5a3b3580..bb30f1ee7c4 100644 --- a/src/tribler-core/tribler_core/modules/dht_health_manager.py +++ b/src/tribler-core/tribler_core/modules/dht_health_manager.py @@ -1,7 +1,7 @@ import math from asyncio import Future -from ipv8.dht.routing import distance, id_to_binary_string +from ipv8.dht.routing import distance from ipv8.taskmanager import TaskManager import libtorrent as lt @@ -127,9 +127,7 @@ def received_bloomfilters(self, node_id, bf_seeds=bytearray(256), bf_peers=bytea # We do not know to which infohash the received get_peers response belongs so we have to manually go through # the infohashes and find the infohash that is the closest to the node id that sent us the message. for infohash in self.lookup_futures: - infohash_bin = id_to_binary_string(infohash) - node_id_bin = id_to_binary_string(node_id) - ih_distance = distance(infohash_bin, node_id_bin) + ih_distance = distance(infohash, node_id) if ih_distance < min_distance or min_distance == -1: min_distance = ih_distance closest_infohash = infohash diff --git a/src/tribler-core/tribler_core/modules/tests/test_dht_health_manager.py b/src/tribler-core/tribler_core/modules/tests/test_dht_health_manager.py index 8e906d51001..dad8eb6ea54 100644 --- a/src/tribler-core/tribler_core/modules/tests/test_dht_health_manager.py +++ b/src/tribler-core/tribler_core/modules/tests/test_dht_health_manager.py @@ -78,7 +78,7 @@ async def test_receive_bloomfilters(self): """ Test whether the right operations happen when receiving a bloom filter """ - infohash = 'a' * 20 + infohash = b'a' * 20 self.dht_health_manager.received_bloomfilters(infohash) # It should not do anything self.assertFalse(self.dht_health_manager.bf_seeders) self.assertFalse(self.dht_health_manager.bf_peers)