mirror of https://github.com/waku-org/nwaku.git
bug: fix hash size greater than 32 (#1621)
This commit is contained in:
parent
157724d9b9
commit
c42ac16fe6
|
@ -21,7 +21,6 @@ import
|
||||||
libp2p/protocols/connectivity/autonat/service,
|
libp2p/protocols/connectivity/autonat/service,
|
||||||
libp2p/nameresolving/nameresolver,
|
libp2p/nameresolving/nameresolver,
|
||||||
libp2p/builders,
|
libp2p/builders,
|
||||||
libp2p/multihash,
|
|
||||||
libp2p/transports/tcptransport,
|
libp2p/transports/tcptransport,
|
||||||
libp2p/transports/wstransport
|
libp2p/transports/wstransport
|
||||||
import
|
import
|
||||||
|
@ -391,11 +390,11 @@ proc registerRelayDefaultHandler(node: WakuNode, topic: PubsubTopic) =
|
||||||
if node.wakuRelay.isSubscribed(topic):
|
if node.wakuRelay.isSubscribed(topic):
|
||||||
return
|
return
|
||||||
|
|
||||||
proc traceHandler(topic: PubsubTopic, data: seq[byte]) {.async, gcsafe.} =
|
proc traceHandler(topic: PubsubTopic, msg: WakuMessage) {.async, gcsafe.} =
|
||||||
trace "waku.relay received",
|
trace "waku.relay received",
|
||||||
peerId=node.peerId,
|
peerId=node.peerId,
|
||||||
pubsubTopic=topic,
|
pubsubTopic=topic,
|
||||||
hash=MultiHash.digest("sha2-256", data).expect("valid hash").data.buffer.to0xHex(), # TODO: this could be replaced by a message UID
|
hash=topic.digest(msg).to0xHex(),
|
||||||
receivedTime=getNowInNanosecondTime()
|
receivedTime=getNowInNanosecondTime()
|
||||||
|
|
||||||
waku_node_messages.inc(labelValues = ["relay"])
|
waku_node_messages.inc(labelValues = ["relay"])
|
||||||
|
@ -418,7 +417,7 @@ proc registerRelayDefaultHandler(node: WakuNode, topic: PubsubTopic) =
|
||||||
if msg.isErr():
|
if msg.isErr():
|
||||||
return
|
return
|
||||||
|
|
||||||
await traceHandler(topic, data)
|
await traceHandler(topic, msg.value)
|
||||||
await filterHandler(topic, msg.value)
|
await filterHandler(topic, msg.value)
|
||||||
await archiveHandler(topic, msg.value)
|
await archiveHandler(topic, msg.value)
|
||||||
|
|
||||||
|
@ -482,10 +481,10 @@ proc publish*(node: WakuNode, topic: PubsubTopic, message: WakuMessage) {.async,
|
||||||
discard await node.wakuRelay.publish(topic, message)
|
discard await node.wakuRelay.publish(topic, message)
|
||||||
|
|
||||||
trace "waku.relay published",
|
trace "waku.relay published",
|
||||||
peerId=node.peerId,
|
peerId=node.peerId,
|
||||||
pubsubTopic=topic,
|
pubsubTopic=topic,
|
||||||
hash=MultiHash.digest("sha2-256", message.encode().buffer).expect("valid hash").data.buffer.to0xHex(), # TODO: this could be replaced by a message UID
|
hash=topic.digest(message).to0xHex(),
|
||||||
publishTime=getNowInNanosecondTime()
|
publishTime=getNowInNanosecondTime()
|
||||||
|
|
||||||
proc startRelay*(node: WakuNode) {.async.} =
|
proc startRelay*(node: WakuNode) {.async.} =
|
||||||
## Setup and start relay protocol
|
## Setup and start relay protocol
|
||||||
|
|
Loading…
Reference in New Issue