From b0718d295e233b76bb47090f8a4e1ecc8ee9ff54 Mon Sep 17 00:00:00 2001 From: Jack Robison Date: Tue, 13 Nov 2018 09:36:52 -0500 Subject: [PATCH] fix empty buckets in routing_table_get --- lbrynet/extras/daemon/Daemon.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lbrynet/extras/daemon/Daemon.py b/lbrynet/extras/daemon/Daemon.py index 71e17c0c1..31dbc3c48 100644 --- a/lbrynet/extras/daemon/Daemon.py +++ b/lbrynet/extras/daemon/Daemon.py @@ -3114,6 +3114,7 @@ class Daemon(AuthJSONRPCServer): result['buckets'] = {} for i in range(len(self.dht_node._routingTable._buckets)): + result['buckets'][i] = [] for contact in self.dht_node._routingTable._buckets[i]._contacts: blobs = list(hosts.pop(contact)) if contact in hosts else [] blob_hashes.update(blobs) @@ -3123,7 +3124,7 @@ class Daemon(AuthJSONRPCServer): "node_id": hexlify(contact.id).decode(), "blobs": blobs, } - result['buckets'].setdefault(i, []).append(host) + result['buckets'][i].append(host) contact_set.add(hexlify(contact.id).decode()) result['contacts'] = list(contact_set)