From e3a515d86a3569a7f500435c7a34baffb76cec47 Mon Sep 17 00:00:00 2001 From: Prem Chaitanya Prathi Date: Fri, 26 Apr 2024 17:51:52 +0530 Subject: [PATCH] fix: parse shards properly in enr config for non twn (#2633) --- waku/factory/internal_config.nim | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/waku/factory/internal_config.nim b/waku/factory/internal_config.nim index 8b8a45f60..877a608ce 100644 --- a/waku/factory/internal_config.nim +++ b/waku/factory/internal_config.nim @@ -32,7 +32,15 @@ proc enrConfiguration*( let shards: seq[uint16] = # no shards configured if conf.shards.len == 0: - toSeq(0 ..< conf.pubsubTopics.len).mapIt(uint16(it)) + var shardsLocal = newSeq[uint16]() + let shardsRes = topicsToRelayShards(conf.pubsubTopics) + if shardsRes.isOk() and shardsRes.get().isSome(): + shardsLocal = shardsRes.get().get().shardIds + else: + error "failed to parse pubsub topic, please format according to static shard specification", + error = shardsRes.error + shardsLocal + # some shards configured else: toSeq(conf.shards.mapIt(uint16(it)))