mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-05-29 02:31:20 +00:00
Replace PeerId with Multihash for interface consistency (#1095)
* Change a PeerId for a Multihash * Update protocols/kad/src/behaviour.rs Co-Authored-By: elferdo <elferdo@gmail.com> * Update protocols/kad/src/behaviour.rs Co-Authored-By: elferdo <elferdo@gmail.com>
This commit is contained in:
parent
68df8c07cf
commit
585f84c88a
@ -293,9 +293,9 @@ impl<TSubstream> Kademlia<TSubstream> {
|
||||
///
|
||||
/// The actual meaning of *providing* the value of a key is not defined, and is specific to
|
||||
/// the value whose key is the hash.
|
||||
pub fn add_providing(&mut self, key: PeerId) {
|
||||
self.providing_keys.insert(key.clone().into());
|
||||
let providers = self.values_providers.entry(key.into()).or_insert_with(Default::default);
|
||||
pub fn add_providing(&mut self, key: Multihash) {
|
||||
self.providing_keys.insert(key.clone());
|
||||
let providers = self.values_providers.entry(key).or_insert_with(Default::default);
|
||||
let my_id = self.kbuckets.my_id();
|
||||
if !providers.iter().any(|peer_id| peer_id == my_id.peer_id()) {
|
||||
providers.push(my_id.peer_id().clone());
|
||||
|
Loading…
x
Reference in New Issue
Block a user