Skip to content

Commit

Permalink
FIND_NODE for own peer id returns closest peers
Browse files Browse the repository at this point in the history
  • Loading branch information
guillaumemichel committed Mar 26, 2024
1 parent a372723 commit ba90e45
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions protocols/kad/src/behaviour.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1180,16 +1180,12 @@ where
target: &kbucket::Key<T>,
source: &PeerId,
) -> Vec<KadPeer> {
if target == self.kbuckets.local_key() {
Vec::new()
} else {
self.kbuckets
.closest(target)
.filter(|e| e.node.key.preimage() != source)
.take(self.queries.config().replication_factor.get())
.map(KadPeer::from)
.collect()
}
self.kbuckets
.closest(target)
.filter(|e| e.node.key.preimage() != source)
.take(self.queries.config().replication_factor.get())
.map(KadPeer::from)
.collect()
}

/// Collects all peers who are known to be providers of the value for a given `Multihash`.
Expand Down

0 comments on commit ba90e45

Please sign in to comment.