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)
|
Port(uint16(conf.tcpPort) + conf.portsShift), extIp, extTcpPort)
|
||||||
|
|
||||||
await node.start()
|
await node.start()
|
||||||
await node.mountRelay()
|
await node.mountRelay(rlnRelayEnabled = conf.rlnrelay)
|
||||||
|
|
||||||
# Subscribe to a topic
|
# Subscribe to a topic
|
||||||
let topic = cast[Topic]("foobar")
|
let topic = cast[Topic]("foobar")
|
||||||
|
|
|
@ -192,9 +192,9 @@ proc processInput(rfd: AsyncFD, rng: ref BrHmacDrbgContext) {.async.} =
|
||||||
await node.start()
|
await node.start()
|
||||||
|
|
||||||
if conf.filternode != "":
|
if conf.filternode != "":
|
||||||
await node.mountRelay(conf.topics.split(" "))
|
await node.mountRelay(conf.topics.split(" "), rlnRelayEnabled = conf.rlnrelay)
|
||||||
else:
|
else:
|
||||||
await node.mountRelay(@[])
|
await node.mountRelay(@[], rlnRelayEnabled = conf.rlnrelay)
|
||||||
|
|
||||||
var chat = Chat(node: node, transp: transp, subscribed: true, connected: false, started: true)
|
var chat = Chat(node: node, transp: transp, subscribed: true, connected: false, started: true)
|
||||||
|
|
||||||
|
|
|
@ -63,6 +63,11 @@ type
|
||||||
defaultValue: true
|
defaultValue: true
|
||||||
name: "relay" }: bool
|
name: "relay" }: bool
|
||||||
|
|
||||||
|
rlnrelay* {.
|
||||||
|
desc: "Flag whether to enable spam protection through rln-relay",
|
||||||
|
defaultValue: false
|
||||||
|
name: "rlnrelay" }: bool
|
||||||
|
|
||||||
swap* {.
|
swap* {.
|
||||||
desc: "Flag whether to start swap protocol",
|
desc: "Flag whether to start swap protocol",
|
||||||
defaultValue: false
|
defaultValue: false
|
||||||
|
|
|
@ -296,7 +296,7 @@ proc mountStore*(node: WakuNode, store: MessageStore = nil) =
|
||||||
node.switch.mount(node.wakuStore)
|
node.switch.mount(node.wakuStore)
|
||||||
node.subscriptions.subscribe(WakuStoreCodec, node.wakuStore.subscription())
|
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
|
# TODO add the RLN registration
|
||||||
let wakuRelay = WakuRelay.init(
|
let wakuRelay = WakuRelay.init(
|
||||||
switch = node.switch,
|
switch = node.switch,
|
||||||
|
@ -306,6 +306,13 @@ proc mountRelay*(node: WakuNode, topics: seq[string] = newSeq[string]()) {.async
|
||||||
sign = false,
|
sign = false,
|
||||||
verifySignature = 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.wakuRelay = wakuRelay
|
||||||
node.switch.mount(wakuRelay)
|
node.switch.mount(wakuRelay)
|
||||||
|
@ -478,7 +485,7 @@ when isMainModule:
|
||||||
mountFilter(node)
|
mountFilter(node)
|
||||||
|
|
||||||
if conf.relay:
|
if conf.relay:
|
||||||
waitFor mountRelay(node, conf.topics.split(" "))
|
waitFor mountRelay(node, conf.topics.split(" "), rlnRelayEnabled = conf.rlnrelay)
|
||||||
|
|
||||||
if conf.staticnodes.len > 0:
|
if conf.staticnodes.len > 0:
|
||||||
waitFor connectToNodes(node, conf.staticnodes)
|
waitFor connectToNodes(node, conf.staticnodes)
|
||||||
|
|
Loading…
Reference in New Issue