diff --git a/src/main/java/org/peergos/protocol/dht/Kademlia.java b/src/main/java/org/peergos/protocol/dht/Kademlia.java index 85b850a3..3e821d65 100644 --- a/src/main/java/org/peergos/protocol/dht/Kademlia.java +++ b/src/main/java/org/peergos/protocol/dht/Kademlia.java @@ -388,7 +388,7 @@ public CompletableFuture publishValue(PrivKey priv, if (toQuery.size() == remaining) { // publish to closest remaining nodes while (publishes.size() < minPublishes) { - List closest = toQuery.stream() + List closest = new TreeSet<>(toQuery).stream() .limit(minPublishes - publishes.size() + 5) .collect(Collectors.toList()); List> lastFutures = closest.stream()