mirror of
https://github.com/status-im/status-go.git
synced 2025-01-09 14:16:21 +00:00
9de77b21b2
Adds support for datasync, V1Messages and disabling the discovery topic. This is a backward compatible change as long as they are not toggled on (they are not by default).
21 lines
386 B
Go
21 lines
386 B
Go
package protobuf
|
|
|
|
import (
|
|
"crypto/sha256"
|
|
"encoding/binary"
|
|
|
|
"github.com/vacp2p/mvds/state"
|
|
)
|
|
|
|
// ID creates the MessageID for a Message
|
|
func (m Message) ID() state.MessageID {
|
|
t := make([]byte, 8)
|
|
binary.LittleEndian.PutUint64(t, uint64(m.Timestamp))
|
|
|
|
b := append([]byte("MESSAGE_ID"), m.GroupId[:]...)
|
|
b = append(b, t...)
|
|
b = append(b, m.Body...)
|
|
|
|
return sha256.Sum256(b)
|
|
}
|