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.
This commit is contained in:
Andre Staltz 2023-10-12 13:12:52 +03:00
parent eff0c57517
commit 4637a24960
No known key found for this signature in database
GPG Key ID: 9EDE23EA7E8A4890
1 changed files with 1 additions and 1 deletions

View File

@ -75,7 +75,7 @@ class Algorithm {
if (maxRemoteHave <= maxLocalHave) return EMPTY_RANGE if (maxRemoteHave <= maxLocalHave) return EMPTY_RANGE
const maxWant = maxRemoteHave const maxWant = maxRemoteHave
const size = Math.max(maxWant - maxLocalHave, count) 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] return [minWant, maxWant]
} }