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
let data = message.encode().buffer
discard await node.wakuRelay.publish(topic, data)
discard await node.wakuRelay.publish(topic, message)
proc startRelay*(node: WakuNode) {.async.} =
## Setup and start relay protocol

View File

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