mirror of
https://github.com/waku-org/nwaku.git
synced 2025-02-28 06:50:56 +00:00
fix: change message ID provider to match go-waku (#1556)
This commit is contained in:
parent
0a15ce48d8
commit
dd5243a41c
@ -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:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user