mirror of
https://github.com/logos-messaging/logos-messaging-go.git
synced 2026-01-07 16:33:08 +00:00
revert(#820): msg digest matches msg hash
This commit is contained in:
parent
4584bb4324
commit
cf82f66d12
@ -1,6 +1,7 @@
|
|||||||
package protocol
|
package protocol
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"github.com/waku-org/go-waku/waku/v2/hash"
|
||||||
wpb "github.com/waku-org/go-waku/waku/v2/protocol/pb"
|
wpb "github.com/waku-org/go-waku/waku/v2/protocol/pb"
|
||||||
"github.com/waku-org/go-waku/waku/v2/protocol/store/pb"
|
"github.com/waku-org/go-waku/waku/v2/protocol/store/pb"
|
||||||
)
|
)
|
||||||
@ -19,11 +20,12 @@ type Envelope struct {
|
|||||||
// as well as generating a hash based on the bytes that compose the message
|
// as well as generating a hash based on the bytes that compose the message
|
||||||
func NewEnvelope(msg *wpb.WakuMessage, receiverTime int64, pubSubTopic string) *Envelope {
|
func NewEnvelope(msg *wpb.WakuMessage, receiverTime int64, pubSubTopic string) *Envelope {
|
||||||
messageHash := msg.Hash(pubSubTopic)
|
messageHash := msg.Hash(pubSubTopic)
|
||||||
|
digest := hash.SHA256([]byte(msg.ContentTopic), msg.Payload)
|
||||||
return &Envelope{
|
return &Envelope{
|
||||||
msg: msg,
|
msg: msg,
|
||||||
hash: messageHash,
|
hash: messageHash,
|
||||||
index: &pb.Index{
|
index: &pb.Index{
|
||||||
Digest: messageHash,
|
Digest: digest[:],
|
||||||
ReceiverTime: receiverTime,
|
ReceiverTime: receiverTime,
|
||||||
SenderTime: msg.Timestamp,
|
SenderTime: msg.Timestamp,
|
||||||
PubsubTopic: pubSubTopic,
|
PubsubTopic: pubSubTopic,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user