diff --git a/CHANGELOG.md b/CHANGELOG.md index 2d9f4856a..7557286b4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,14 @@ at anytime. ### Fixed * * + * Fixed slow startup for nodes with many lbry files + * Fixed setting the external ip on startup + * Fixed session startup not blocking on joining the dht + * Fixed several parsing bugs that prevented replacing dead dht contacts + * Fixed lbryid length validation + * Fixed an old print statement that polluted logs + * Fixed rpc id length for dht requests + * Fixed amount of closed nodes to add to list in case of extension to neighbouring k-buckets ### Deprecated * diff --git a/lbrynet/dht/routingtable.py b/lbrynet/dht/routingtable.py index 8f3661f49..ec2ee75e0 100644 --- a/lbrynet/dht/routingtable.py +++ b/lbrynet/dht/routingtable.py @@ -138,15 +138,14 @@ class TreeRoutingTable(object): # Fill up the node list to k nodes, starting with the closest neighbouring nodes known while len(closestNodes) < min(count, constants.k) and (canGoLower or canGoHigher): # TODO: this may need to be optimized + remain = min(count, constants.k) - len(closestNodes) if canGoLower: closestNodes.extend( - self._buckets[bucketIndex - i].getContacts( - constants.k - len(closestNodes), _rpcNodeID)) + self._buckets[bucketIndex - i].getContacts(remain, _rpcNodeID)) canGoLower = bucketIndex - (i + 1) >= 0 if canGoHigher: closestNodes.extend( - self._buckets[bucketIndex + i].getContacts(constants.k - len(closestNodes), - _rpcNodeID)) + self._buckets[bucketIndex + i].getContacts(remain, _rpcNodeID)) canGoHigher = bucketIndex + (i + 1) < len(self._buckets) i += 1 return closestNodes