mirror of https://github.com/waku-org/nwaku.git
Quicksim failing example
This commit is contained in:
parent
bcaaf7056f
commit
bb1403a378
|
@ -13,37 +13,62 @@ createRpcSigs(RpcHttpClient, sigWakuPath)
|
|||
|
||||
const topicAmount = 100
|
||||
|
||||
let node1 = newRpcHttpClient()
|
||||
let node2 = newRpcHttpClient()
|
||||
let node3 = newRpcHttpClient()
|
||||
let node4 = newRpcHttpClient()
|
||||
let node5 = newRpcHttpClient()
|
||||
let node6 = newRpcHttpClient()
|
||||
|
||||
waitFor node1.connect("localhost", Port(8547))
|
||||
waitFor node2.connect("localhost", Port(8548))
|
||||
waitFor node3.connect("localhost", Port(8549))
|
||||
waitFor node4.connect("localhost", Port(8550))
|
||||
waitFor node5.connect("localhost", Port(8551))
|
||||
waitFor node6.connect("localhost", Port(8552))
|
||||
|
||||
let version = waitFor node6.wakuVersion()
|
||||
info "Version is", version
|
||||
|
||||
proc handler(topic: string, data: seq[byte]) {.async, gcsafe.} =
|
||||
debug "Hit handler", topic=topic, data=data
|
||||
|
||||
# TODO: Implement handler logic
|
||||
# All subscribing to foobar topic
|
||||
let res2 = waitFor node2.wakuSubscribe("foobar")
|
||||
let res3 = waitFor node3.wakuSubscribe("foobar")
|
||||
let res4 = waitFor node4.wakuSubscribe("foobar")
|
||||
let res5 = waitFor node5.wakuSubscribe("foobar")
|
||||
let res6 = waitFor node6.wakuSubscribe("foobar")
|
||||
# All full nodes connected etc
|
||||
#
|
||||
# let node1 = newRpcHttpClient()
|
||||
# let node2 = newRpcHttpClient()
|
||||
# let node3 = newRpcHttpClient()
|
||||
# let node4 = newRpcHttpClient()
|
||||
# let node5 = newRpcHttpClient()
|
||||
# let node6 = newRpcHttpClient()
|
||||
|
||||
# waitFor node1.connect("localhost", Port(8547))
|
||||
# waitFor node2.connect("localhost", Port(8548))
|
||||
# waitFor node3.connect("localhost", Port(8549))
|
||||
# waitFor node4.connect("localhost", Port(8550))
|
||||
# waitFor node5.connect("localhost", Port(8551))
|
||||
# waitFor node6.connect("localhost", Port(8552))
|
||||
|
||||
# let version = waitFor node6.wakuVersion()
|
||||
# info "Version is", version
|
||||
|
||||
# # TODO: Implement handler logic
|
||||
# # All subscribing to foobar topic
|
||||
# let res2 = waitFor node2.wakuSubscribe("foobar")
|
||||
# let res3 = waitFor node3.wakuSubscribe("foobar")
|
||||
# let res4 = waitFor node4.wakuSubscribe("foobar")
|
||||
# let res5 = waitFor node5.wakuSubscribe("foobar")
|
||||
# let res6 = waitFor node6.wakuSubscribe("foobar")
|
||||
# os.sleep(2000)
|
||||
|
||||
# # info "Posting envelopes on all subscribed topics"
|
||||
# for i in 0..<topicAmount:
|
||||
# os.sleep(50)
|
||||
# let res2 = waitFor node1.wakuPublish("foobar", "hello world")
|
||||
|
||||
# os.sleep(2000)
|
||||
|
||||
# for i in 0..<topicAmount:
|
||||
# os.sleep(50)
|
||||
# let res2 = waitFor node1.wakuPublish("foobar", "hello world2")
|
||||
|
||||
let nodea = newRpcHttpClient()
|
||||
let nodeb = newRpcHttpClient()
|
||||
|
||||
waitFor nodea.connect("localhost", Port(8545))
|
||||
waitFor nodeb.connect("localhost", Port(8546))
|
||||
|
||||
let version = waitFor nodea.wakuVersion()
|
||||
info "Version is", version
|
||||
|
||||
let res1 = waitFor nodea.wakuSubscribe("foobar")
|
||||
let res2 = waitFor nodeb.wakuSubscribe("foobar")
|
||||
|
||||
os.sleep(2000)
|
||||
|
||||
# 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(50)
|
||||
let res3 = waitFor nodea.wakuPublish("foobar", "hello world")
|
||||
|
|
|
@ -94,6 +94,14 @@ when isMainModule:
|
|||
staticnodes.add(nodes[i].address)
|
||||
|
||||
# TODO: Here we could add a light node, but not clear thats what we want to test?
|
||||
# Lets call them edge nodes
|
||||
# NOTE: Only connecting to one node here
|
||||
var nodesubseta: seq[string]
|
||||
var nodesubsetb: seq[string]
|
||||
nodesubseta.add(staticnodes[0])
|
||||
nodesubsetb.add(staticnodes[amount-1])
|
||||
nodes.add(initNodeCmd(0, nodesubseta, label = "edge node (A)"))
|
||||
nodes.add(initNodeCmd(1, nodesubsetb, label = "edge node (B)"))
|
||||
|
||||
var commandStr = "multitail -s 2 -M 0 -x \"Waku Simulation\""
|
||||
var count = 0
|
||||
|
|
Loading…
Reference in New Issue