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,26 +87,34 @@ when isMainModule:
|
|||
of inspectRlnDb:
|
||||
doInspectRlnDb(conf)
|
||||
of noCommand:
|
||||
# The Waku Network config (cluster-id=1)
|
||||
if conf.clusterId == 1:
|
||||
let twnClusterConf = ClusterConf.TheWakuNetworkConf()
|
||||
if len(conf.shards) != 0:
|
||||
conf.pubsubTopics = conf.shards.mapIt(twnClusterConf.pubsubTopics[it.uint16])
|
||||
else:
|
||||
conf.pubsubTopics = twnClusterConf.pubsubTopics
|
||||
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])
|
||||
else:
|
||||
conf.pubsubTopics = twnClusterConf.pubsubTopics
|
||||
|
||||
# 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
|
||||
conf.discv5Discovery = twnClusterConf.discv5Discovery
|
||||
conf.discv5BootstrapNodes =
|
||||
conf.discv5BootstrapNodes & twnClusterConf.discv5BootstrapNodes
|
||||
conf.rlnEpochSizeSec = twnClusterConf.rlnEpochSizeSec
|
||||
conf.rlnRelayUserMessageLimit = twnClusterConf.rlnRelayUserMessageLimit
|
||||
# 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
|
||||
conf.discv5Discovery = twnClusterConf.discv5Discovery
|
||||
conf.discv5BootstrapNodes =
|
||||
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