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

fix: correct KBucketTree types #426

Merged
merged 2 commits into from
Mar 10, 2023
Merged

fix: correct KBucketTree types #426

merged 2 commits into from
Mar 10, 2023

Conversation

joeltg
Copy link
Contributor

@joeltg joeltg commented Mar 2, 2023

As the k-bucket documentation here indicates, toIterable yields contact objects, not KBucket objects. Here, the contact objects are KBucketPeer objects.

You can check this in the code here - the delegated yield yield * node.contacts will yield each of the elements of the node.contacts array in order.

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.
@joeltg joeltg changed the title Fix KBucketTree types fix! correct KBucketTree types Mar 2, 2023
@joeltg joeltg changed the title fix! correct KBucketTree types fix: correct KBucketTree types Mar 2, 2023
@achingbrain achingbrain merged commit ea8e6d0 into libp2p:master Mar 10, 2023
@achingbrain
Copy link
Member

Thanks!

github-actions bot pushed a commit that referenced this pull request Mar 10, 2023
## [7.0.1](v7.0.0...v7.0.1) (2023-03-10)

### Bug Fixes

* correct `KBucketTree` types ([#426](#426)) ([ea8e6d0](ea8e6d0)), closes [/github.com/tristanls/k-bucket/blob/3aa5b4f1dacb835752995a25409ab319d2070b9e/index.js#L413](https://github.com/libp2p//github.com/tristanls/k-bucket/blob/3aa5b4f1dacb835752995a25409ab319d2070b9e/index.js/issues/L413)
* update p-queue types ([#428](#428)) ([f5b85fc](f5b85fc))

### Trivial Changes

* replace err-code with CodeError ([#413](#413)) ([e05d2a0](e05d2a0)), closes [js-libp2p#1269](libp2p/js-libp2p#1269)
* Update .github/workflows/semantic-pull-request.yml [skip ci] ([a70ab3f](a70ab3f))
* Update .github/workflows/semantic-pull-request.yml [skip ci] ([1652c6c](1652c6c))
* Update .github/workflows/semantic-pull-request.yml [skip ci] ([ea13c2a](ea13c2a))
@joeltg joeltg deleted the patch-1 branch March 10, 2023 14:01
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants