fix: change message ID provider to match go-waku (#1556)

This commit is contained in:
Hanno Cornelius 2023-02-13 18:22:34 +02:00 committed by GitHub
parent 0a15ce48d8
commit dd5243a41c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -8,7 +8,7 @@ else:
{.push raises: [].} {.push raises: [].}
import import
std/[tables, sequtils, hashes], std/[tables, sequtils],
stew/results, stew/results,
chronos, chronos,
chronicles, chronicles,
@ -80,11 +80,8 @@ method initPubSub(w: WakuRelay) {.raises: [InitializationError].} =
proc new*(T: type WakuRelay, switch: Switch, triggerSelf: bool = true): WakuRelayResult[T] = proc new*(T: type WakuRelay, switch: Switch, triggerSelf: bool = true): WakuRelayResult[T] =
proc msgIdProvider(msg: messages.Message): Result[MessageID, ValidationResult] = proc msgIdProvider(msg: messages.Message): Result[MessageID, ValidationResult] =
let hash = MultiHash.digest("sha2-256", msg.data) let hash = sha256.digest(msg.data)
if hash.isErr(): ok(toSeq(hash.data))
ok(toBytes($hashes.hash(msg.data)))
else:
ok(hash.value.data.buffer)
var wr: WakuRelay var wr: WakuRelay
try: try: