forked from LBRYCommunity/lbry-sdk
fix empty buckets in routing_table_get
This commit is contained in:
parent
9bb91b126d
commit
b0718d295e
1 changed files with 2 additions and 1 deletions
|
@ -3114,6 +3114,7 @@ class Daemon(AuthJSONRPCServer):
|
||||||
result['buckets'] = {}
|
result['buckets'] = {}
|
||||||
|
|
||||||
for i in range(len(self.dht_node._routingTable._buckets)):
|
for i in range(len(self.dht_node._routingTable._buckets)):
|
||||||
|
result['buckets'][i] = []
|
||||||
for contact in self.dht_node._routingTable._buckets[i]._contacts:
|
for contact in self.dht_node._routingTable._buckets[i]._contacts:
|
||||||
blobs = list(hosts.pop(contact)) if contact in hosts else []
|
blobs = list(hosts.pop(contact)) if contact in hosts else []
|
||||||
blob_hashes.update(blobs)
|
blob_hashes.update(blobs)
|
||||||
|
@ -3123,7 +3124,7 @@ class Daemon(AuthJSONRPCServer):
|
||||||
"node_id": hexlify(contact.id).decode(),
|
"node_id": hexlify(contact.id).decode(),
|
||||||
"blobs": blobs,
|
"blobs": blobs,
|
||||||
}
|
}
|
||||||
result['buckets'].setdefault(i, []).append(host)
|
result['buckets'][i].append(host)
|
||||||
contact_set.add(hexlify(contact.id).decode())
|
contact_set.add(hexlify(contact.id).decode())
|
||||||
|
|
||||||
result['contacts'] = list(contact_set)
|
result['contacts'] = list(contact_set)
|
||||||
|
|
Loading…
Add table
Reference in a new issue