mirror of https://github.com/waku-org/nwaku.git
6 nodes in quicksim and post 100 messages
This commit is contained in:
parent
4f4f623b96
commit
037e164058
|
@ -1,8 +1,8 @@
|
||||||
import
|
import
|
||||||
os, strformat, chronicles, json_rpc/[rpcclient, rpcserver], nimcrypto/sysrand,
|
os, strformat, chronicles, json_rpc/[rpcclient, rpcserver], nimcrypto/sysrand,
|
||||||
eth/common as eth_common, eth/keys,
|
eth/common as eth_common, eth/keys,
|
||||||
../v1/rpc/[hexstrings, rpc_types],
|
options
|
||||||
options as what # TODO: Huh? Redefinition?
|
#options as what # TODO: Huh? Redefinition?
|
||||||
|
|
||||||
from os import DirSep
|
from os import DirSep
|
||||||
from strutils import rsplit
|
from strutils import rsplit
|
||||||
|
@ -11,16 +11,16 @@ template sourceDir: string = currentSourcePath.rsplit(DirSep, 1)[0]
|
||||||
const sigWakuPath = &"{sourceDir}{DirSep}rpc{DirSep}wakucallsigs.nim"
|
const sigWakuPath = &"{sourceDir}{DirSep}rpc{DirSep}wakucallsigs.nim"
|
||||||
createRpcSigs(RpcHttpClient, sigWakuPath)
|
createRpcSigs(RpcHttpClient, sigWakuPath)
|
||||||
|
|
||||||
|
const topicAmount = 100
|
||||||
|
|
||||||
let node1 = newRpcHttpClient()
|
let node1 = newRpcHttpClient()
|
||||||
let node2 = newRpcHttpClient()
|
let node2 = newRpcHttpClient()
|
||||||
|
|
||||||
info "Hello there"
|
|
||||||
|
|
||||||
# portsShift=2
|
|
||||||
waitFor node1.connect("localhost", Port(8547))
|
waitFor node1.connect("localhost", Port(8547))
|
||||||
waitFor node2.connect("localhost", Port(8548))
|
waitFor node2.connect("localhost", Port(8548))
|
||||||
|
|
||||||
let version = waitFor node1.wakuVersion()
|
#let version = waitFor node1.wakuVersion()
|
||||||
|
#info "Version is", version
|
||||||
|
|
||||||
proc handler(topic: string, data: seq[byte]) {.async, gcsafe.} =
|
proc handler(topic: string, data: seq[byte]) {.async, gcsafe.} =
|
||||||
debug "Hit handler", topic=topic, data=data
|
debug "Hit handler", topic=topic, data=data
|
||||||
|
@ -28,6 +28,9 @@ proc handler(topic: string, data: seq[byte]) {.async, gcsafe.} =
|
||||||
# TODO: Implement handler logic
|
# TODO: Implement handler logic
|
||||||
let res1 = waitFor node2.wakuSubscribe("foobar")
|
let res1 = waitFor node2.wakuSubscribe("foobar")
|
||||||
os.sleep(2000)
|
os.sleep(2000)
|
||||||
let res2 = waitFor node1.wakuPublish("foobar", "hello world")
|
|
||||||
|
# info "Posting envelopes on all subscribed topics"
|
||||||
|
for i in 0..<topicAmount:
|
||||||
|
let res2 = waitFor node1.wakuPublish("foobar", "hello world")
|
||||||
|
|
||||||
os.sleep(2000)
|
os.sleep(2000)
|
||||||
info "Version is", version
|
|
||||||
|
|
|
@ -68,7 +68,7 @@ proc starNetwork(amount: int): seq[NodeInfo] =
|
||||||
when isMainModule:
|
when isMainModule:
|
||||||
# TODO: WakuNetworkConf
|
# TODO: WakuNetworkConf
|
||||||
var nodes: seq[NodeInfo]
|
var nodes: seq[NodeInfo]
|
||||||
let amount = 2
|
let amount = 6
|
||||||
nodes = starNetwork(amount)
|
nodes = starNetwork(amount)
|
||||||
|
|
||||||
var commandStr = "multitail -s 2 -M 0 -x \"Waku Simulation\""
|
var commandStr = "multitail -s 2 -M 0 -x \"Waku Simulation\""
|
||||||
|
|
Loading…
Reference in New Issue