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

Commit

Permalink
fix: correct KBucketTree types (#426)
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
joeltg and achingbrain authored Mar 10, 2023
1 parent f5b85fc commit ea8e6d0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/routing-table/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export interface KBucketTree {
add: (peer: KBucketPeer) => void
get: (key: Uint8Array) => Uint8Array
count: () => number
toIterable: () => Iterable<KBucket>
toIterable: () => Iterable<KBucketPeer>
}

export interface RoutingTableInit {
Expand Down

0 comments on commit ea8e6d0

Please sign in to comment.