From 5937ead17c069d15328015d99e732b1f6ad3d71e Mon Sep 17 00:00:00 2001 From: Jack Robison Date: Tue, 10 Oct 2017 13:28:57 -0400 Subject: [PATCH] add Node.contacts helper property --- lbrynet/dht/node.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lbrynet/dht/node.py b/lbrynet/dht/node.py index 7ea3d3947..fdc476a83 100644 --- a/lbrynet/dht/node.py +++ b/lbrynet/dht/node.py @@ -171,6 +171,14 @@ class Node(object): self.hash_watcher.tick() yield self._joinDeferred + @property + def contacts(self): + def _inner(): + for i in range(len(self._routingTable._buckets)): + for contact in self._routingTable._buckets[i]._contacts: + yield contact + return list(_inner()) + def printContacts(self, *args): print '\n\nNODE CONTACTS\n===============' for i in range(len(self._routingTable._buckets)):