refactor(relay): simplify relay publish jsonrpc api

This commit is contained in:
Lorenzo Delgado 2023-01-25 14:35:38 +01:00 committed by GitHub
parent 028efc8547
commit b84c54bbcb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 4 deletions

View File

@ -364,8 +364,7 @@ proc publish*(node: WakuNode, topic: PubsubTopic, message: WakuMessage) {.async,
trace "publish", topic=topic, contentTopic=message.contentTopic trace "publish", topic=topic, contentTopic=message.contentTopic
let data = message.encode().buffer discard await node.wakuRelay.publish(topic, message)
discard await node.wakuRelay.publish(topic, data)
proc startRelay*(node: WakuNode) {.async.} = proc startRelay*(node: WakuNode) {.async.} =
## Setup and start relay protocol ## Setup and start relay protocol

View File

@ -147,10 +147,10 @@ method publish*(w: WakuRelay, pubsubTopic: PubsubTopic, message: WakuMessage|seq
var data: seq[byte] var data: seq[byte]
when message is WakuMessage: when message is WakuMessage:
data = message.encode() data = message.encode().buffer
else: else:
data = message data = message
return await procCall GossipSub(w).publish(pubsubTopic, message) return await procCall GossipSub(w).publish(pubsubTopic, data)