From 59b592c8252cfab380d4cd9b50988601cc1d3c38 Mon Sep 17 00:00:00 2001 From: saul Date: Mon, 12 Feb 2024 15:55:40 +1300 Subject: [PATCH] fix: prevent the heads promise from throwing --- src/utils/heads-exchange.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/utils/heads-exchange.ts b/src/utils/heads-exchange.ts index e73d32d5..553a8c45 100644 --- a/src/utils/heads-exchange.ts +++ b/src/utils/heads-exchange.ts @@ -163,8 +163,6 @@ export class HeadsExchange { return this.headsPromise } - this.headsPromise = new DeferredPromise() - const { filter, hashes } = createFilter(this.heads, { seed: this.localSeed, collisionRate: this.collisionRate @@ -181,6 +179,8 @@ export class HeadsExchange { this.writer.push({ filter: message }) + this.headsPromise = new DeferredPromise() + return this.headsPromise }