mirror of https://github.com/waku-org/nwaku.git
Adds rln-relay flag (#347)
* adds rlnrelay flag * minor edit * adds the input name
This commit is contained in:
parent
96f95ed0b6
commit
cc1fc15d38
|
@ -23,7 +23,7 @@ proc runBackground() {.async.} =
|
|||
Port(uint16(conf.tcpPort) + conf.portsShift), extIp, extTcpPort)
|
||||
|
||||
await node.start()
|
||||
await node.mountRelay()
|
||||
await node.mountRelay(rlnRelayEnabled = conf.rlnrelay)
|
||||
|
||||
# Subscribe to a topic
|
||||
let topic = cast[Topic]("foobar")
|
||||
|
|
|
@ -192,9 +192,9 @@ proc processInput(rfd: AsyncFD, rng: ref BrHmacDrbgContext) {.async.} =
|
|||
await node.start()
|
||||
|
||||
if conf.filternode != "":
|
||||
await node.mountRelay(conf.topics.split(" "))
|
||||
await node.mountRelay(conf.topics.split(" "), rlnRelayEnabled = conf.rlnrelay)
|
||||
else:
|
||||
await node.mountRelay(@[])
|
||||
await node.mountRelay(@[], rlnRelayEnabled = conf.rlnrelay)
|
||||
|
||||
var chat = Chat(node: node, transp: transp, subscribed: true, connected: false, started: true)
|
||||
|
||||
|
|
|
@ -62,6 +62,11 @@ type
|
|||
desc: "Flag whether to start relay protocol",
|
||||
defaultValue: true
|
||||
name: "relay" }: bool
|
||||
|
||||
rlnrelay* {.
|
||||
desc: "Flag whether to enable spam protection through rln-relay",
|
||||
defaultValue: false
|
||||
name: "rlnrelay" }: bool
|
||||
|
||||
swap* {.
|
||||
desc: "Flag whether to start swap protocol",
|
||||
|
|
|
@ -296,7 +296,7 @@ proc mountStore*(node: WakuNode, store: MessageStore = nil) =
|
|||
node.switch.mount(node.wakuStore)
|
||||
node.subscriptions.subscribe(WakuStoreCodec, node.wakuStore.subscription())
|
||||
|
||||
proc mountRelay*(node: WakuNode, topics: seq[string] = newSeq[string]()) {.async, gcsafe.} =
|
||||
proc mountRelay*(node: WakuNode, topics: seq[string] = newSeq[string](), rlnRelayEnabled: bool = false) {.async, gcsafe.} =
|
||||
# TODO add the RLN registration
|
||||
let wakuRelay = WakuRelay.init(
|
||||
switch = node.switch,
|
||||
|
@ -306,6 +306,13 @@ proc mountRelay*(node: WakuNode, topics: seq[string] = newSeq[string]()) {.async
|
|||
sign = false,
|
||||
verifySignature = false
|
||||
)
|
||||
# TODO if rln-relay enabled, then perform registration
|
||||
if rlnRelayEnabled:
|
||||
debug "Using WakuRLNRelay"
|
||||
else:
|
||||
debug "WakuRLNRelay is disabled"
|
||||
|
||||
|
||||
|
||||
node.wakuRelay = wakuRelay
|
||||
node.switch.mount(wakuRelay)
|
||||
|
@ -478,7 +485,7 @@ when isMainModule:
|
|||
mountFilter(node)
|
||||
|
||||
if conf.relay:
|
||||
waitFor mountRelay(node, conf.topics.split(" "))
|
||||
waitFor mountRelay(node, conf.topics.split(" "), rlnRelayEnabled = conf.rlnrelay)
|
||||
|
||||
if conf.staticnodes.len > 0:
|
||||
waitFor connectToNodes(node, conf.staticnodes)
|
||||
|
|
Loading…
Reference in New Issue