diff --git a/protocols/kad/CHANGELOG.md b/protocols/kad/CHANGELOG.md index bfc4eb37e82d..dcd23fb53947 100644 --- a/protocols/kad/CHANGELOG.md +++ b/protocols/kad/CHANGELOG.md @@ -4,6 +4,8 @@ See [PR 4659](https://github.com/libp2p/rust-libp2p/pull/4659). - Emit `ModeChanged` event whenever we automatically reconfigure the mode. See [PR 4503](https://github.com/libp2p/rust-libp2p/pull/4503). +- Expose hashed bytes of KBucketKey. + See [PR 4698](https://github.com/libp2p/rust-libp2p/pull/4698). ## 0.44.6 diff --git a/protocols/kad/src/kbucket/key.rs b/protocols/kad/src/kbucket/key.rs index 15cedaaaa325..ba5383912ee9 100644 --- a/protocols/kad/src/kbucket/key.rs +++ b/protocols/kad/src/kbucket/key.rs @@ -77,6 +77,11 @@ impl Key { self.bytes.distance(other) } + /// Exposing the hashed bytes. + pub fn hashed_bytes(&self) -> &[u8] { + &self.bytes.0 + } + /// Returns the uniquely determined key with the given distance to `self`. /// /// This implements the following equivalence: