diff --git a/ipv8/messaging/anonymization/community.py b/ipv8/messaging/anonymization/community.py index 0deb0e780..0f23be838 100644 --- a/ipv8/messaging/anonymization/community.py +++ b/ipv8/messaging/anonymization/community.py @@ -260,7 +260,7 @@ def do_circuits(self) -> None: self.logger.info("Want %d data circuits of length %d", num_to_build, circuit_length) for _ in range(num_to_build): if not self.create_circuit(circuit_length): - self.logger.info("circuit creation of %d circuits failed, no need to continue", num_to_build) + self.logger.info("Circuit creation of %d circuits failed, no need to continue", num_to_build) break self.do_remove() @@ -271,8 +271,7 @@ def build_tunnels(self, hops: int) -> None: The number of circuits created for this hop count is dictated by the ``max_circuits`` setting. """ if hops > 0: - self.circuits_needed[hops] = max(self.settings.max_circuits, - min(self.settings.max_circuits, self.circuits_needed.get(hops, 0) + 1)) + self.circuits_needed[hops] = self.settings.max_circuits self.do_circuits() def tunnels_ready(self, hops: int) -> float: diff --git a/ipv8/messaging/anonymization/hidden_services.py b/ipv8/messaging/anonymization/hidden_services.py index 28ed03dfa..92ebd1a9e 100644 --- a/ipv8/messaging/anonymization/hidden_services.py +++ b/ipv8/messaging/anonymization/hidden_services.py @@ -139,12 +139,8 @@ def leave_swarm(self, info_hash: bytes) -> None: CIRCUIT_TYPE_RP_DOWNLOADER]: _ = self.remove_circuit(circuit.circuit_id, 'leaving hidden swarm', destroy=DESTROY_REASON_UNNEEDED) # Remove swarm and callback - swarm = self.swarms.pop(info_hash, None) + self.swarms.pop(info_hash, None) self.e2e_callbacks.pop(info_hash, None) - # If there are no other swarms with the same hop count, remove the data circuits - if swarm and not [s for s in self.swarms.values() if s != swarm and s.hops == swarm.hops]: - for circuit in self.find_circuits(hops=swarm.hops, state=None): - _ = self.remove_circuit(circuit.circuit_id, 'not needed', destroy=DESTROY_REASON_UNNEEDED) async def estimate_swarm_size(self, info_hash: bytes, hops: int = 1, max_requests: int = 10) -> int: """ diff --git a/ipv8/test/messaging/anonymization/test_hiddenservices.py b/ipv8/test/messaging/anonymization/test_hiddenservices.py index 1cd9d52a1..478577898 100644 --- a/ipv8/test/messaging/anonymization/test_hiddenservices.py +++ b/ipv8/test/messaging/anonymization/test_hiddenservices.py @@ -9,7 +9,6 @@ from ....messaging.anonymization.hidden_services import HiddenTunnelCommunity, HiddenTunnelSettings from ....messaging.anonymization.payload import TestRequestPayload from ....messaging.anonymization.tunnel import ( - CIRCUIT_TYPE_DATA, CIRCUIT_TYPE_IP_SEEDER, PEER_FLAG_EXIT_BT, PEER_FLAG_RELAY, @@ -218,7 +217,6 @@ async def test_dht_lookup_with_counterparty(self) -> None: await sleep(.1) self.assertFalse(self.overlay(0).find_circuits(ctype=CIRCUIT_TYPE_IP_SEEDER)) self.assertFalse(self.overlay(0).find_circuits(ctype=CIRCUIT_TYPE_RP_DOWNLOADER)) - self.assertFalse(self.overlay(0).find_circuits(ctype=CIRCUIT_TYPE_DATA)) async def test_dht_lookup_no_counterparty(self) -> None: """