Skip to content

Commit

Permalink
fix: parse shards properly in enr config for non twn
Browse files Browse the repository at this point in the history
  • Loading branch information
chaitanyaprem committed Apr 25, 2024
1 parent 7f8d8e8 commit a098f9d
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion waku/factory/internal_config.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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]()
for item in conf.pubsubTopics:
let pusubTopicRes = NsPubsubTopic.parseStaticSharding(item)
if pusubTopicRes.isOk():
shardsLocal.add(pusubTopicRes.get().shardId)
else:
error "failed to parse pubsubTopic", error = pusubTopicRes.error
shardsLocal

# some shards configured
else:
toSeq(conf.shards.mapIt(uint16(it)))
Expand Down

0 comments on commit a098f9d

Please sign in to comment.