mirror of
https://github.com/waku-org/nwaku.git
synced 2025-01-13 00:05:10 +00:00
4a8e62ac5e
* test_protocol.nim: enhance test reboot and connect - Is not necessary to start the node if the switch object has been already started - Enable an existing "Relay can receive messages after reboot and reconnect" test - Explicit reconnect to peer in "Relay can receive messages after reboot and reconnect" test * tests/waku_relay/utils: avoid starting the proto again in newTestSwitch proc With that, we avoid double start of the protocol. * bump nim-libp2p
22 lines
624 B
Nim
22 lines
624 B
Nim
{.used.}
|
|
|
|
import std/[strutils], stew/shims/net as stewNet, chronos
|
|
|
|
import ../../../waku/waku_relay, ../../../waku/waku_core, ../testlib/wakucore
|
|
|
|
proc noopRawHandler*(): WakuRelayHandler =
|
|
var handler: WakuRelayHandler
|
|
handler = proc(topic: PubsubTopic, msg: WakuMessage): Future[void] {.async, gcsafe.} =
|
|
discard
|
|
handler
|
|
|
|
proc newTestWakuRelay*(switch = newTestSwitch()): Future[WakuRelay] {.async.} =
|
|
let proto = WakuRelay.new(switch).tryGet()
|
|
|
|
let protocolMatcher = proc(proto: string): bool {.gcsafe.} =
|
|
return proto.startsWith(WakuRelayCodec)
|
|
|
|
switch.mount(proto, protocolMatcher)
|
|
|
|
return proto
|