mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-08 21:08:10 -05:00
use full hash (#7416)
This commit is contained in:
@@ -79,10 +79,10 @@ func (s *Service) SubscribeToTopic(topic string, opts ...pubsub.SubOpt) (*pubsub
|
||||
// Content addressable ID function.
|
||||
//
|
||||
// ETH2 spec defines the message ID as:
|
||||
// message-id: SHA256(message.data)[:8]
|
||||
// message-id: SHA256(message.data)
|
||||
func msgIDFunction(pmsg *pubsub_pb.Message) string {
|
||||
h := hashutil.Hash(pmsg.Data)
|
||||
return string(h[:8])
|
||||
return string(h[:])
|
||||
}
|
||||
|
||||
func setPubSubParameters() {
|
||||
|
||||
@@ -33,6 +33,6 @@ func TestMessageIDFunction_HashesCorrectly(t *testing.T) {
|
||||
msg := [32]byte{'J', 'U', 'N', 'K'}
|
||||
pMsg := &pubsubpb.Message{Data: msg[:]}
|
||||
hashedData := hashutil.Hash(pMsg.Data)
|
||||
msgID := string(hashedData[:8])
|
||||
msgID := string(hashedData[:])
|
||||
assert.Equal(t, msgID, msgIDFunction(pMsg), "Got incorrect msg id")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user