Skip to content

Commit

Permalink
refactor of internal_config to avoid passing a 'WakuNodeConf' item (#…
Browse files Browse the repository at this point in the history
…1832)

This change is needed so that the `libwaku.nim` code gets simpler. The
`libwaku.nim` can't import the 'WakuNodeConf' type because this is
related to the wakunode2 app, and the library shouldn't know about it.
  • Loading branch information
Ivansete-status committed Jun 29, 2023
1 parent 88b7481 commit 96aa59b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion apps/wakunode2/app.nim
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ proc init*(T: type App, rng: ref HmacDrbgContext, conf: WakuNodeConf): T =
quit(QuitFailure)
else: netConfigRes.get()

let recordRes = createRecord(conf, netConfig, key)
let recordRes = createRecord(conf.topics, netConfig, key)
let record =
if recordRes.isErr():
error "failed to create record", error=recordRes.error
Expand Down
7 changes: 5 additions & 2 deletions apps/wakunode2/internal_config.nim
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,11 @@ proc networkConfiguration*(conf: WakuNodeConf): NetConfigResult =

netConfigRes

proc createRecord*(conf: WakuNodeConf, netConf: NetConfig, key: crypto.PrivateKey): Result[enr.Record, string] =
let relayShardsRes = topicsToRelayShards(conf.topics)
proc createRecord*(topics: seq[string],
netConf: NetConfig,
key: crypto.PrivateKey):
Result[enr.Record, string] =
let relayShardsRes = topicsToRelayShards(topics)

let relayShardOp =
if relayShardsRes.isErr():
Expand Down

0 comments on commit 96aa59b

Please sign in to comment.