Fix testdaemon.nim.

This commit is contained in:
cheatfate 2019-03-04 20:51:10 +02:00
parent 53467d028f
commit 77f34af737
No known key found for this signature in database
GPG Key ID: 46ADD633A7201F95
3 changed files with 6 additions and 4 deletions

View File

@ -28,7 +28,7 @@ proc main() {.async.} =
ticket: PubsubTicket,
message: PubSubMessage): Future[bool] {.async.} =
let msglen = len(message.data)
echo "= Recieved pubsub message wit length ", msglen,
echo "= Recieved pubsub message with length ", msglen,
" bytes from peer ", message.peer.pretty()
echo dumpHex(message.data)
await api.dumpSubscribedPeers()

View File

@ -16,8 +16,10 @@ proc main(bn: string) {.async.} =
ticket: PubsubTicket,
message: PubSubMessage): Future[bool] {.async.} =
let msglen = len(message.data)
echo "= Recieved pubsub message wit length ", msglen,
" bytes from peer ", message.peer.pretty()
echo "= Recieved pubsub message with length ", msglen,
" bytes from peer ", message.peer.pretty(), ": "
var strdata = cast[string](message.data)
echo strdata
result = true
var ticket = await api.pubsubSubscribe("test-net", pubsubLogger)

View File

@ -1,7 +1,7 @@
import unittest
import chronos
import ../libp2p/daemon/daemonapi, ../libp2p/multiaddress, ../libp2p/multicodec,
../libp2p/cid, ../libp2p/multihash
../libp2p/cid, ../libp2p/multihash, ../libp2p/peer
proc identitySpawnTest(): Future[bool] {.async.} =
var api = await newDaemonApi()