use blake2b hash as the message ID function
This commit is contained in:
@@ -8,6 +8,7 @@ import (
|
||||
peer "github.com/libp2p/go-libp2p-core/peer"
|
||||
pubsub "github.com/libp2p/go-libp2p-pubsub"
|
||||
pubsub_pb "github.com/libp2p/go-libp2p-pubsub/pb"
|
||||
blake2b "github.com/minio/blake2b-simd"
|
||||
ma "github.com/multiformats/go-multiaddr"
|
||||
"go.uber.org/fx"
|
||||
|
||||
@@ -207,6 +208,11 @@ func GossipSub(cfg *config.Pubsub) interface{} {
|
||||
}
|
||||
}
|
||||
|
||||
func HashMsgId(m *pubsub_pb.Message) string {
|
||||
hash := blake2b.Sum256(m.Data)
|
||||
return string(hash[:])
|
||||
}
|
||||
|
||||
func newTracerWrapper(tr pubsub.EventTracer) pubsub.EventTracer {
|
||||
return &tracerWrapper{tr: tr}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user