Use hazelnut sets instead of dictionaries to avoid duplicate hazels

This commit is contained in:
2021-01-05 20:26:22 +01:00
parent c7c8765fad
commit f062ee7b13
2 changed files with 17 additions and 18 deletions

View File

@ -233,8 +233,7 @@ class NeighbourTLV(TLV):
# This case should never happen (and in our protocol it is not possible),
# but we include this test as a security measure.
return
if not (str(self.ip_address), self.port) in squirrel.active_hazelnuts \
and not (str(self.ip_address), self.port) in squirrel.potential_hazelnuts:
if not (str(self.ip_address), self.port) in squirrel.hazelnuts:
hazelnut = squirrel.new_hazel(str(self.ip_address), self.port)
hazelnut.potential = True
squirrel.update_hazelnut_table(hazelnut)