bmuller / kademlia

A DHT in Python using asyncio
http://kademlia.readthedocs.org
MIT License
830 stars 210 forks source link

Exception when republishing keys #25

Closed pendleto closed 7 years ago

pendleto commented 7 years ago

There is an issue when republishing keys. In RefreshTable all the keys older than one hour are republished. The problem is in network.py where the key is set. Since the "key" when republishing is actually a sha1 digest you do not need to create a digest of it again. In addition the self.log.debug() messages will throw an exception because the key is a digest, not a string.

def set(self, key, value):
    """
    Set the given key to the given value in the network.
    """
    self.log.debug("setting '%s' = '%s' on network" % (key, value)) <-- key is a digest OR a string here
bmuller commented 7 years ago

Good catch! Should be fixed in e58c710 now