From 96aa59ba58eff4cb4a75fdc80b9dd1e2bebf478d Mon Sep 17 00:00:00 2001 From: Ivan Folgueira Bande <128452529+Ivansete-status@users.noreply.github.com> Date: Thu, 29 Jun 2023 11:01:14 +0200 Subject: [PATCH] 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. --- apps/wakunode2/app.nim | 2 +- apps/wakunode2/internal_config.nim | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/apps/wakunode2/app.nim b/apps/wakunode2/app.nim index 98e2cae32..8381c36e8 100644 --- a/apps/wakunode2/app.nim +++ b/apps/wakunode2/app.nim @@ -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 diff --git a/apps/wakunode2/internal_config.nim b/apps/wakunode2/internal_config.nim index 28938017f..07239d98c 100644 --- a/apps/wakunode2/internal_config.nim +++ b/apps/wakunode2/internal_config.nim @@ -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():