From 8f2bd08a6095641d6a54fdae1402fb9c7ba43534 Mon Sep 17 00:00:00 2001 From: Jacob Karlsson Date: Sun, 9 Jun 2024 17:42:24 +0200 Subject: [PATCH] Don't throw on missing local want range --- lib/stream.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/stream.js b/lib/stream.js index cb6bc1f..f06378b 100644 --- a/lib/stream.js +++ b/lib/stream.js @@ -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)