mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-25 12:57:18 +00:00
65e3f3e007
* add pubsub message ID * thanks linter * Update rules_go, gogo protobuf, comment * Merge branch 'master' into add-msg-fn-id
18 lines
465 B
Go
18 lines
465 B
Go
package p2p
|
|
|
|
import (
|
|
"encoding/base64"
|
|
|
|
"github.com/libp2p/go-libp2p-pubsub/pb"
|
|
"github.com/prysmaticlabs/prysm/shared/hashutil"
|
|
)
|
|
|
|
// Content addressable ID function.
|
|
//
|
|
// Loosely defined as Base64(sha2(data)) until a formal specification is determined.
|
|
// Pending: https://github.com/ethereum/eth2.0-specs/issues/1528
|
|
func msgIDFunction(pmsg *pubsub_pb.Message) string {
|
|
h := hashutil.FastSum256(pmsg.Data)
|
|
return base64.URLEncoding.EncodeToString(h[:])
|
|
}
|