mirror of https://github.com/waku-org/nwaku.git
chore: remove dupe handling of the private key
This commit is contained in:
parent
4efa7a1879
commit
222be9eb13
|
@ -44,7 +44,6 @@ type Waku* = object
|
||||||
version: string
|
version: string
|
||||||
conf: WakuNodeConf
|
conf: WakuNodeConf
|
||||||
rng: ref HmacDrbgContext
|
rng: ref HmacDrbgContext
|
||||||
key: crypto.PrivateKey
|
|
||||||
|
|
||||||
wakuDiscv5*: WakuDiscoveryV5
|
wakuDiscv5*: WakuDiscoveryV5
|
||||||
dynamicBootstrapNodes: seq[RemotePeerInfo]
|
dynamicBootstrapNodes: seq[RemotePeerInfo]
|
||||||
|
@ -54,6 +53,9 @@ type Waku* = object
|
||||||
restServer*: WakuRestServerRef
|
restServer*: WakuRestServerRef
|
||||||
metricsServer*: MetricsHttpServerRef
|
metricsServer*: MetricsHttpServerRef
|
||||||
|
|
||||||
|
proc key*(waku: Waku): crypto.PrivateKey =
|
||||||
|
waku.node.key
|
||||||
|
|
||||||
proc logConfig(conf: WakuNodeConf) =
|
proc logConfig(conf: WakuNodeConf) =
|
||||||
info "Configuration: Enabled protocols",
|
info "Configuration: Enabled protocols",
|
||||||
relay = conf.relay,
|
relay = conf.relay,
|
||||||
|
@ -121,7 +123,6 @@ proc init*(T: type Waku, srcConf: WakuNodeConf): Result[Waku, string] =
|
||||||
version: git_version,
|
version: git_version,
|
||||||
conf: finalConf,
|
conf: finalConf,
|
||||||
rng: rng,
|
rng: rng,
|
||||||
key: finalConf.nodekey.get(),
|
|
||||||
node: nodeRes.get(),
|
node: nodeRes.get(),
|
||||||
dynamicBootstrapNodes: dynamicBootstrapNodesRes.get(),
|
dynamicBootstrapNodes: dynamicBootstrapNodesRes.get(),
|
||||||
)
|
)
|
||||||
|
@ -200,8 +201,13 @@ proc startWaku*(waku: ptr Waku): Future[Result[void, string]] {.async: (raises:
|
||||||
## Discv5
|
## Discv5
|
||||||
if waku[].conf.discv5Discovery or waku[].conf.discv5Only:
|
if waku[].conf.discv5Discovery or waku[].conf.discv5Only:
|
||||||
waku[].wakuDiscV5 = waku_discv5.setupDiscoveryV5(
|
waku[].wakuDiscV5 = waku_discv5.setupDiscoveryV5(
|
||||||
waku.node.enr, waku.node.peerManager, waku.node.topicSubscriptionQueue, waku.conf,
|
waku.node.enr,
|
||||||
waku.dynamicBootstrapNodes, waku.rng, waku.key,
|
waku.node.peerManager,
|
||||||
|
waku.node.topicSubscriptionQueue,
|
||||||
|
waku.conf,
|
||||||
|
waku.dynamicBootstrapNodes,
|
||||||
|
waku.rng,
|
||||||
|
waku[].key(),
|
||||||
)
|
)
|
||||||
|
|
||||||
(await waku.wakuDiscV5.start()).isOkOr:
|
(await waku.wakuDiscV5.start()).isOkOr:
|
||||||
|
|
|
@ -189,6 +189,9 @@ proc info*(node: WakuNode): WakuInfo =
|
||||||
let wakuInfo = WakuInfo(listenAddresses: listenStr, enrUri: enrUri)
|
let wakuInfo = WakuInfo(listenAddresses: listenStr, enrUri: enrUri)
|
||||||
return wakuInfo
|
return wakuInfo
|
||||||
|
|
||||||
|
proc key*(node: WakuNode): crypto.PrivateKey =
|
||||||
|
node.switch.peerInfo.privateKey
|
||||||
|
|
||||||
proc connectToNodes*(
|
proc connectToNodes*(
|
||||||
node: WakuNode, nodes: seq[RemotePeerInfo] | seq[string], source = "api"
|
node: WakuNode, nodes: seq[RemotePeerInfo] | seq[string], source = "api"
|
||||||
) {.async.} =
|
) {.async.} =
|
||||||
|
|
Loading…
Reference in New Issue