diff --git a/protocols/kad/CHANGELOG.md b/protocols/kad/CHANGELOG.md index 3cf725e61e3..d2b92195ab3 100644 --- a/protocols/kad/CHANGELOG.md +++ b/protocols/kad/CHANGELOG.md @@ -6,6 +6,8 @@ See [PR 4503](https://github.com/libp2p/rust-libp2p/pull/4503). - Make previously "deprecated" `record` module private. See [PR 4035](https://github.com/libp2p/rust-libp2p/pull/4035). +- Expose hashed bytes of KBucketKey. + See [PR 4698](https://github.com/libp2p/rust-libp2p/pull/4698). - Remove previously deprecated type-aliases. Users should follow the convention of importing the `libp2p::kad` module and referring to symbols as `kad::Behaviour` etc. See [PR 4733](https://github.com/libp2p/rust-libp2p/pull/4733). diff --git a/protocols/kad/src/kbucket/key.rs b/protocols/kad/src/kbucket/key.rs index 93bcce793f0..bc5d6a53750 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: