diff --git a/tests/v2/utils.nim b/tests/v2/utils.nim index f4a7bee5b..ac32c2dae 100644 --- a/tests/v2/utils.nim +++ b/tests/v2/utils.nim @@ -35,7 +35,6 @@ proc generateNodes*( verifySignature = verifySignature, sign = sign, # XXX unclear why including this causes a compiler error, it is part of WakuRelay type - #gossipEnabled = gossip, msgIdProvider = msgIdProvider).PubSub switch.mount(wakuRelay) diff --git a/waku/v2/protocol/waku_relay.nim b/waku/v2/protocol/waku_relay.nim index e72e3f3d1..7694c352d 100644 --- a/waku/v2/protocol/waku_relay.nim +++ b/waku/v2/protocol/waku_relay.nim @@ -5,7 +5,7 @@ import chronos, chronicles, metrics, - libp2p/protocols/pubsub/[pubsub, floodsub, gossipsub], + libp2p/protocols/pubsub/[pubsub, gossipsub], libp2p/protocols/pubsub/rpc/messages, libp2p/stream/connection, ../waku_types @@ -35,14 +35,7 @@ method init*(w: WakuRelay) = method initPubSub*(w: WakuRelay) = debug "initWakuRelay" - # Not using GossipSub - # XXX: FloodSub subscribe doesn't work - w.gossipEnabled = true - - if w.gossipEnabled: - procCall GossipSub(w).initPubSub() - else: - procCall FloodSub(w).initPubSub() + procCall GossipSub(w).initPubSub() w.init() @@ -50,10 +43,8 @@ method subscribe*(w: WakuRelay, pubSubTopic: string, handler: TopicHandler) {.async.} = debug "subscribe", pubSubTopic=pubSubTopic - if w.gossipEnabled: - await procCall GossipSub(w).subscribe(pubSubTopic, handler) - else: - await procCall FloodSub(w).subscribe(pubSubTopic, handler) + + await procCall GossipSub(w).subscribe(pubSubTopic, handler) method publish*(w: WakuRelay, pubSubTopic: string, @@ -61,38 +52,25 @@ method publish*(w: WakuRelay, ): Future[int] {.async.} = debug "publish", pubSubTopic=pubSubTopic, message=message - if w.gossipEnabled: - return await procCall GossipSub(w).publish(pubSubTopic, message) - else: - return await procCall FloodSub(w).publish(pubSubTopic, message) + return await procCall GossipSub(w).publish(pubSubTopic, message) method unsubscribe*(w: WakuRelay, topics: seq[TopicPair]) {.async.} = debug "unsubscribe" - if w.gossipEnabled: - await procCall GossipSub(w).unsubscribe(topics) - else: - await procCall FloodSub(w).unsubscribe(topics) + + await procCall GossipSub(w).unsubscribe(topics) method unsubscribeAll*(w: WakuRelay, pubSubTopic: string) {.async.} = debug "unsubscribeAll" - if w.gossipEnabled: - await procCall GossipSub(w).unsubscribeAll(pubSubTopic) - else: - await procCall FloodSub(w).unsubscribeAll(pubSubTopic) + + await procCall GossipSub(w).unsubscribeAll(pubSubTopic) # GossipSub specific methods -------------------------------------------------- method start*(w: WakuRelay) {.async.} = debug "start" - if w.gossipEnabled: - await procCall GossipSub(w).start() - else: - await procCall FloodSub(w).start() + await procCall GossipSub(w).start() method stop*(w: WakuRelay) {.async.} = debug "stop" - if w.gossipEnabled: - await procCall GossipSub(w).stop() - else: - await procCall FloodSub(w).stop() + await procCall GossipSub(w).stop() diff --git a/waku/v2/waku_types.nim b/waku/v2/waku_types.nim index 74f3aa2b1..c16a33ae2 100644 --- a/waku/v2/waku_types.nim +++ b/waku/v2/waku_types.nim @@ -88,7 +88,6 @@ type Filters* = Table[string, Filter] WakuRelay* = ref object of GossipSub - gossipEnabled*: bool WakuInfo* = object # NOTE One for simplicity, can extend later as needed