From 4637a24960d53e2a5fe06c8f0125e9a9ffe6f4cc Mon Sep 17 00:00:00 2001 From: Andre Staltz Date: Thu, 12 Oct 2023 13:12:52 +0300 Subject: [PATCH] fix calculation of wantRange for newest goal We shouldn't use maxLocalHave+1 because we are interested in EVERYTHING the remote peer has, as long as it is inside the "size" defined for this goal. Bloom filters will then make sure we are not getting what we already have in this range. --- lib/algorithm.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/algorithm.js b/lib/algorithm.js index 476ec9e..61d3b96 100644 --- a/lib/algorithm.js +++ b/lib/algorithm.js @@ -75,7 +75,7 @@ class Algorithm { if (maxRemoteHave <= maxLocalHave) return EMPTY_RANGE const maxWant = maxRemoteHave const size = Math.max(maxWant - maxLocalHave, count) - const minWant = Math.max(maxWant - size, maxLocalHave + 1, minRemoteHave) + const minWant = Math.max(maxWant - size, minRemoteHave) return [minWant, maxWant] }