From 471beb5fbdb18fa9c333c813e294437275ff4b80 Mon Sep 17 00:00:00 2001 From: jm-clius Date: Mon, 24 May 2021 11:42:21 +0000 Subject: [PATCH] deploy: e0d8d8f4680e630fb2eee05baef4cedd1da39b8c --- examples/v2/matterbridge/chat2bridge.nim | 4 +++- .../vendor/libbacktrace-upstream/libtool | 2 +- waku/common/wakubridge.nim | 12 +++++++----- waku/v2/node/wakunode2.nim | 5 +++-- 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/examples/v2/matterbridge/chat2bridge.nim b/examples/v2/matterbridge/chat2bridge.nim index e3285b8fa..9a6f3874a 100644 --- a/examples/v2/matterbridge/chat2bridge.nim +++ b/examples/v2/matterbridge/chat2bridge.nim @@ -172,7 +172,9 @@ proc start*(cmb: Chat2MatterBridge) {.async.} = debug "Start listening on Waku v2" await cmb.nodev2.start() - cmb.nodev2.mountRelay() # Always mount relay for bridge + # Always mount relay for bridge + # `triggerSelf` is false on a `bridge` to avoid duplicates + cmb.nodev2.mountRelay(triggerSelf = false) # Bridging # Handle messages on Waku v2 and bridge to Matterbridge diff --git a/vendor/nim-libbacktrace/vendor/libbacktrace-upstream/libtool b/vendor/nim-libbacktrace/vendor/libbacktrace-upstream/libtool index 69e90fe5b..2e78ab49d 100755 --- a/vendor/nim-libbacktrace/vendor/libbacktrace-upstream/libtool +++ b/vendor/nim-libbacktrace/vendor/libbacktrace-upstream/libtool @@ -2,7 +2,7 @@ # libtool - Provide generalized library-building support services. # Generated automatically by config.status (libbacktrace) version-unused -# Libtool was configured on host fv-az182-211: +# Libtool was configured on host fv-az231-806: # NOTE: Changes made to this file will be lost: look at ltmain.sh. # # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, diff --git a/waku/common/wakubridge.nim b/waku/common/wakubridge.nim index 42971ddc1..a08defb04 100644 --- a/waku/common/wakubridge.nim +++ b/waku/common/wakubridge.nim @@ -65,27 +65,27 @@ func toWakuMessage(env: Envelope): WakuMessage = proc toWakuV2(bridge: WakuBridge, env: Envelope) {.async.} = let msg = env.toWakuMessage() - debug "message converted to V2", msg=msg - if bridge.seen.containsOrAdd(msg.encode().buffer.hash()): # This is a duplicate message. Return trace "Already seen. Dropping.", msg=msg waku_bridge_dropped.inc(labelValues = ["duplicate"]) return + + trace "Sending message to V2", msg=msg waku_bridge_transfers.inc(labelValues = ["v1_to_v2"]) await bridge.nodev2.publish(DefaultBridgeTopic, msg) proc toWakuV1(bridge: WakuBridge, msg: WakuMessage) {.gcsafe.} = - debug "sending message to V1", msg=msg - if bridge.seen.containsOrAdd(msg.encode().buffer.hash()): # This is a duplicate message. Return trace "Already seen. Dropping.", msg=msg waku_bridge_dropped.inc(labelValues = ["duplicate"]) return + trace "Sending message to V1", msg=msg + waku_bridge_transfers.inc(labelValues = ["v2_to_v1"]) # @TODO: use namespacing to map v2 contentTopics to v1 topics @@ -154,7 +154,9 @@ proc start*(bridge: WakuBridge) {.async.} = debug "Start listening on Waku v2" await bridge.nodev2.start() - bridge.nodev2.mountRelay() # Always mount relay for bridge + # Always mount relay for bridge. + # `triggerSelf` is false on a `bridge` to avoid duplicates + bridge.nodev2.mountRelay(triggerSelf = false) # Bridging # Handle messages on Waku v1 and bridge to Waku v2 diff --git a/waku/v2/node/wakunode2.nim b/waku/v2/node/wakunode2.nim index 579682649..61d51f265 100644 --- a/waku/v2/node/wakunode2.nim +++ b/waku/v2/node/wakunode2.nim @@ -441,12 +441,13 @@ proc mountRelay*(node: WakuNode, topics: seq[string] = newSeq[string](), rlnRelayEnabled = false, keepAlive = false, - relayMessages = true) {.gcsafe.} = + relayMessages = true, + triggerSelf = true) {.gcsafe.} = let wakuRelay = WakuRelay.init( switch = node.switch, # Use default #msgIdProvider = msgIdProvider, - triggerSelf = true, + triggerSelf = triggerSelf, sign = false, verifySignature = false )