Skip to content
This repository was archived by the owner on Jul 21, 2023. It is now read-only.

Commit ea8e6d0

Browse files
joeltgachingbrain
andauthored
fix: correct KBucketTree types (#426)
As the `k-bucket` documentation [here](https://github.com/tristanls/k-bucket/blob/master/README.md#kbuckettoiterable) indicates, `toIterable` yields contact objects, **not** `KBucket` objects. Here, the contact objects are `KBucketPeer` objects. You can check this in the code [here](https://github.com/tristanls/k-bucket/blob/3aa5b4f1dacb835752995a25409ab319d2070b9e/index.js#L413) - the delegated yield `yield * node.contacts` will yield each of the elements of the `node.contacts` array in order. Co-authored-by: Alex Potsides <[email protected]>
1 parent f5b85fc commit ea8e6d0

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/routing-table/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export interface KBucketTree {
5151
add: (peer: KBucketPeer) => void
5252
get: (key: Uint8Array) => Uint8Array
5353
count: () => number
54-
toIterable: () => Iterable<KBucket>
54+
toIterable: () => Iterable<KBucketPeer>
5555
}
5656

5757
export interface RoutingTableInit {

0 commit comments

Comments
 (0)