fix: parse shards properly in enr config for non twn (#2633)

This commit is contained in:
Prem Chaitanya Prathi 2024-04-26 17:51:52 +05:30 committed by GitHub
parent 2a4c0f1543
commit 6e6cb298a3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 9 additions and 1 deletions

View File

@ -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)))