Don't throw on missing local want range

This commit is contained in:
Jacob Karlsson 2024-06-09 17:42:24 +02:00
parent a517fd465c
commit 8f2bd08a60
1 changed files with 1 additions and 2 deletions

View File

@ -208,8 +208,7 @@ class SyncStream extends Pipeable {
this.#remoteHave.set(id, remoteHaveRange)
this.#remoteWant.set(id, remoteWantRange)
const goal = this.#goals.get(id)
const haveRange = this.#localHave.get(id)
if (!haveRange) throw new Error(`Local have-range not set for ${id}`)
const haveRange = this.#localHave.get(id) ?? [-1, -1]
const localWant = await this.#algo.wantRange(haveRange, remoteHaveRange, goal)
this.#localWant.set(id, localWant)
const localBloom0 = await this.#algo.bloomFor(id, 0, localWant)