refactor of internal_config to avoid passing a 'WakuNodeConf' item (#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.
This commit is contained in:
Ivan Folgueira Bande 2023-06-29 11:01:14 +02:00 committed by GitHub
parent 88b7481f29
commit 96aa59ba58
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 3 deletions

View File

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

View File

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