mirror of
https://github.com/waku-org/nwaku.git
synced 2025-01-14 17:04:53 +00:00
fix: bring back default topic in config (#1902)
* fix: bring back default topic in config * fix * Fix a bug * Fix enr creation
This commit is contained in:
parent
b785b6ba15
commit
d5d2243c2e
@ -135,16 +135,16 @@ proc init*(T: type App, rng: ref HmacDrbgContext, conf: WakuNodeConf): T =
|
|||||||
error "failed to parse content topic", error=res.error
|
error "failed to parse content topic", error=res.error
|
||||||
quit(QuitFailure)
|
quit(QuitFailure)
|
||||||
|
|
||||||
let pubsubTopicsRes = contentTopicsRes.mapIt(singleHighestWeigthShard(it.get()))
|
let shardsRes = contentTopicsRes.mapIt(singleHighestWeigthShard(it.get()))
|
||||||
|
|
||||||
for res in pubsubTopicsRes:
|
for res in shardsRes:
|
||||||
if res.isErr():
|
if res.isErr():
|
||||||
error "failed to shard content topic", error=res.error
|
error "failed to shard content topic", error=res.error
|
||||||
quit(QuitFailure)
|
quit(QuitFailure)
|
||||||
|
|
||||||
let pubsubTopics = pubsubTopicsRes.mapIt($it.get())
|
let shards = shardsRes.mapIt($it.get())
|
||||||
|
|
||||||
let topics = pubsubTopics & conf.pubsubTopics
|
let topics = conf.topics & conf.pubsubTopics & shards
|
||||||
|
|
||||||
let addShardedTopics = enrBuilder.withShardedTopics(topics)
|
let addShardedTopics = enrBuilder.withShardedTopics(topics)
|
||||||
if addShardedTopics.isErr():
|
if addShardedTopics.isErr():
|
||||||
@ -360,7 +360,12 @@ proc setupProtocols(node: WakuNode,
|
|||||||
peerExchangeHandler = some(handlePeerExchange)
|
peerExchangeHandler = some(handlePeerExchange)
|
||||||
|
|
||||||
if conf.relay:
|
if conf.relay:
|
||||||
let pubsubTopics = conf.pubsubTopics
|
# TODO autoshard content topics only once.
|
||||||
|
# Already checked for errors in app.init
|
||||||
|
let contentTopics = conf.contentTopics.mapIt(NsContentTopic.parse(it).expect("Parsing"))
|
||||||
|
let shards = contentTopics.mapIt($(singleHighestWeigthShard(it).expect("Sharding")))
|
||||||
|
|
||||||
|
let pubsubTopics = conf.topics & conf.pubsubTopics & shards
|
||||||
try:
|
try:
|
||||||
await mountRelay(node, pubsubTopics, peerExchangeHandler = peerExchangeHandler)
|
await mountRelay(node, pubsubTopics, peerExchangeHandler = peerExchangeHandler)
|
||||||
except CatchableError:
|
except CatchableError:
|
||||||
|
@ -225,9 +225,13 @@ type
|
|||||||
defaultValue: false
|
defaultValue: false
|
||||||
name: "keep-alive" }: bool
|
name: "keep-alive" }: bool
|
||||||
|
|
||||||
|
topics* {.
|
||||||
|
desc: "Default topic to subscribe to. Argument may be repeated. Deprecated! Please use pubsub-topic and/or content-topic instead."
|
||||||
|
defaultValue: @["/waku/2/default-waku/proto"]
|
||||||
|
name: "topic" .}: seq[string]
|
||||||
|
|
||||||
pubsubTopics* {.
|
pubsubTopics* {.
|
||||||
desc: "Default pubsub topic to subscribe to. Argument may be repeated."
|
desc: "Default pubsub topic to subscribe to. Argument may be repeated."
|
||||||
defaultValue: @["/waku/2/default-waku/proto"]
|
|
||||||
name: "pubsub-topic" .}: seq[string]
|
name: "pubsub-topic" .}: seq[string]
|
||||||
|
|
||||||
contentTopics* {.
|
contentTopics* {.
|
||||||
|
@ -23,7 +23,7 @@ proc defaultTestWakuNodeConf(): WakuNodeConf =
|
|||||||
metricsServerAddress: ValidIpAddress.init("127.0.0.1"),
|
metricsServerAddress: ValidIpAddress.init("127.0.0.1"),
|
||||||
nat: "any",
|
nat: "any",
|
||||||
maxConnections: 50,
|
maxConnections: 50,
|
||||||
pubsubTopics: @["/waku/2/default-waku/proto"],
|
topics: @["/waku/2/default-waku/proto"],
|
||||||
relay: true
|
relay: true
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user