From e5dde6f9e94d8288681c196c9ab22eddf367a756 Mon Sep 17 00:00:00 2001 From: Franck Royer Date: Thu, 26 May 2022 15:00:22 +1000 Subject: [PATCH] Minor fixes --- src/lib/waku_filter/index.ts | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/lib/waku_filter/index.ts b/src/lib/waku_filter/index.ts index c015ac3558..d0e501c210 100644 --- a/src/lib/waku_filter/index.ts +++ b/src/lib/waku_filter/index.ts @@ -20,7 +20,7 @@ type FilterSubscriptionOpts = { /** * The Pubsub topic for the subscription */ - topic?: string; + pubsubTopic?: string; /** * Optionally specify a PeerId for the subscription. If not included, will use a random peer. */ @@ -65,7 +65,7 @@ export class WakuFilter { opts: FilterSubscriptionOpts, callback: FilterCallback ): Promise { - const topic = opts.topic || DefaultPubSubTopic; + const topic = opts.pubsubTopic || DefaultPubSubTopic; const contentFilters = opts.contentTopics.map((contentTopic) => ({ contentTopic, })); @@ -76,13 +76,20 @@ export class WakuFilter { true ); - const peer = await this.getPeer(); + const peer = await this.getPeer(opts.peerId); const stream = await this.newStream(peer); try { await pipe([request.encode()], lp.encode(), stream); } catch (e) { - log("Error subscribing", e); + log( + "Error subscribing to peer ", + peer.id.toB58String(), + "for content topics", + opts.contentTopics, + ": ", + e + ); throw e; }