@libp2p/gossipsub 16.1.1 → 17.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/index.ts CHANGED
@@ -197,6 +197,18 @@ export interface GossipsubOpts extends GossipsubOptsSpec {
197
197
  */
198
198
  allowedTopics?: string[] | Set<string>
199
199
 
200
+ /**
201
+ * A per-peer memory budget for tracking that peer's topic subscriptions. Each
202
+ * subscribed topic costs its string length plus a fixed per-entry overhead
203
+ * (~1 KiB, approximating the Map/Set bookkeeping), so this bounds both the
204
+ * total topic bytes and the number of topics a single peer may occupy in the
205
+ * topics map (roughly budget / 1 KiB topics). Subscriptions beyond the budget
206
+ * are ignored; a peer that reaches it silently stops receiving messages for
207
+ * further topics, so keep this well above any legitimate peer's needs.
208
+ * (default 1 MiB, ~1000 topics)
209
+ */
210
+ maxTopicBytesPerPeer?: number
211
+
200
212
  /**
201
213
  * Limits to bound protobuf decoding
202
214
  */