mirror of https://github.com/waku-org/nwaku.git
fix: cluster-id 0 disc5 issue (#2562)
This commit is contained in:
parent
c87545d53d
commit
a76c958766
|
@ -16,7 +16,17 @@ type ClusterConf* = object
|
|||
discv5Discovery*: bool
|
||||
discv5BootstrapNodes*: seq[string]
|
||||
|
||||
# cluster-id=1
|
||||
# cluster-id=0
|
||||
# Cluster configuration for the default pubsub topic. Note that it
|
||||
# overrides existing cli configuration
|
||||
proc ClusterZeroConf*(T: type ClusterConf): ClusterConf =
|
||||
return ClusterConf(
|
||||
clusterId: 0.uint32,
|
||||
pubsubTopics: @["/waku/2/default-waku/proto"]
|
||||
# TODO: Add more config such as bootstrap, etc
|
||||
)
|
||||
|
||||
# cluster-id=1 (aka The Waku Network)
|
||||
# Cluster configuration corresponding to The Waku Network. Note that it
|
||||
# overrides existing cli configuration
|
||||
proc TheWakuNetworkConf*(T: type ClusterConf): ClusterConf =
|
||||
|
|
|
@ -87,8 +87,14 @@ when isMainModule:
|
|||
of inspectRlnDb:
|
||||
doInspectRlnDb(conf)
|
||||
of noCommand:
|
||||
# The Waku Network config (cluster-id=1)
|
||||
if conf.clusterId == 1:
|
||||
case conf.clusterId
|
||||
# cluster-id=0
|
||||
of 0:
|
||||
let clusterZeroConf = ClusterConf.ClusterZeroConf()
|
||||
conf.pubsubTopics = clusterZeroConf.pubsubTopics
|
||||
# TODO: Write some template to "merge" the configs
|
||||
# cluster-id=1 (aka The Waku Network)
|
||||
of 1:
|
||||
let twnClusterConf = ClusterConf.TheWakuNetworkConf()
|
||||
if len(conf.shards) != 0:
|
||||
conf.pubsubTopics = conf.shards.mapIt(twnClusterConf.pubsubTopics[it.uint16])
|
||||
|
@ -107,6 +113,8 @@ when isMainModule:
|
|||
conf.discv5BootstrapNodes & twnClusterConf.discv5BootstrapNodes
|
||||
conf.rlnEpochSizeSec = twnClusterConf.rlnEpochSizeSec
|
||||
conf.rlnRelayUserMessageLimit = twnClusterConf.rlnRelayUserMessageLimit
|
||||
else:
|
||||
discard
|
||||
|
||||
info "Running nwaku node", version = app.git_version
|
||||
logConfig(conf)
|
||||
|
|
Loading…
Reference in New Issue