diff --git a/src/network/dandelion.py b/src/network/dandelion.py index 6c34f525..e661fffb 100644 --- a/src/network/dandelion.py +++ b/src/network/dandelion.py @@ -105,14 +105,13 @@ class Dandelion(): # pylint: disable=old-style-class #hashMap is has any value # if not [hasmap for hasmap in self.hashMap.items()] ==[]: try: - if self.hashMap: - for k, v in iter({ - k: v for k, v in iter([hasmap for hasmap in self.hashMap.items()]) - if v.child is None - }).items(): - self.hashMap[k] = Stem( - connection, v.stream, self.poissonTimeout()) - invQueue.put((v.stream, k, v.child)) + for k, v in { + k: v for k, v in iter([hasmap for hasmap in self.hashMap.items()]) + if v.child is None + }.items(): + self.hashMap[k] = Stem( + connection, v.stream, self.poissonTimeout()) + invQueue.put((v.stream, k, v.child)) except AttributeError: pass @@ -139,10 +138,10 @@ class Dandelion(): # pylint: disable=old-style-class k for k, v in iter(self.nodeMap.items()) if v == connection ): self.nodeMap[k] = None - for k, v in iter({ + for k, v in { k: v for k, v in iter(iter([hasmap for hasmap in self.hashMap.items()])) if v.child == connection - }).items(): + }.items(): self.hashMap[k] = Stem( None, v.stream, self.poissonTimeout())