Skip to content

Commit

Permalink
only mounting rlnRelay if relay is configured
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielmer committed Jul 12, 2024
1 parent e269dca commit 2f298e9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
8 changes: 5 additions & 3 deletions examples/wakustealthcommitments/node_spec.nim
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{.push raises: [].}

import
waku/[common/logging, factory/[waku, networks_config, external_config]]
import waku/[common/logging, factory/[waku, networks_config, external_config]]
import
std/[options, strutils, os, sequtils],
stew/shims/net as stewNet,
Expand Down Expand Up @@ -35,7 +34,6 @@ proc setup*(): Waku =
# Override configuration
conf.maxMessageSize = twnClusterConf.maxMessageSize
conf.clusterId = twnClusterConf.clusterId
conf.rlnRelay = twnClusterConf.rlnRelay
conf.rlnRelayEthContractAddress = twnClusterConf.rlnRelayEthContractAddress
conf.rlnRelayDynamic = twnClusterConf.rlnRelayDynamic
conf.rlnRelayBandwidthThreshold = twnClusterConf.rlnRelayBandwidthThreshold
Expand All @@ -45,6 +43,10 @@ proc setup*(): Waku =
conf.rlnEpochSizeSec = twnClusterConf.rlnEpochSizeSec
conf.rlnRelayUserMessageLimit = twnClusterConf.rlnRelayUserMessageLimit

# Only set rlnRelay to true if relay is configured
if conf.relay:
conf.rlnRelay = twnClusterConf.rlnRelay

debug "Starting node"
var waku = Waku.init(conf).valueOr:
error "Waku initialization failed", error = error
Expand Down
4 changes: 4 additions & 0 deletions waku/factory/waku.nim
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,10 @@ proc init*(T: type Waku, conf: WakuNodeConf): Result[Waku, string] =
confCopy.discv5BootstrapNodes & twnClusterConf.discv5BootstrapNodes
confCopy.rlnEpochSizeSec = twnClusterConf.rlnEpochSizeSec
confCopy.rlnRelayUserMessageLimit = twnClusterConf.rlnRelayUserMessageLimit

# Only set rlnRelay to true if relay is configured
if confCopy.relay:
confCopy.rlnRelay = twnClusterConf.rlnRelay
else:
discard

Expand Down

0 comments on commit 2f298e9

Please sign in to comment.