Skip to content

Commit

Permalink
chore(service/header): rename inner msgID func to a shorter one
Browse files Browse the repository at this point in the history
  • Loading branch information
Wondertan committed Feb 14, 2022
1 parent ce3a7ea commit c1960d8
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions service/header/p2p_subscriber.go
Expand Up @@ -84,7 +84,7 @@ func (p *P2PSubscriber) Broadcast(ctx context.Context, header *ExtendedHeader) e
// msgID computes an id for a pubsub message
// TODO(@Wondertan): This cause additional allocations per each recvd message in the topic. Find a way to avoid those.
func msgID(pmsg *pb.Message) string {
msgID := func(data []byte) string {
mID := func(data []byte) string {
hash := blake2b.Sum256(data)
return string(hash[:])
}
Expand All @@ -93,7 +93,7 @@ func msgID(pmsg *pb.Message) string {
if err != nil {
// There is nothing we can do about the error, and it will be anyway caught during validation.
// We also *have* to return some ID for the msg, so give the hash of even faulty msg
return msgID(pmsg.Data)
return mID(pmsg.Data)
}

// IMPORTANT NOTE:
Expand All @@ -110,8 +110,8 @@ func msgID(pmsg *pb.Message) string {
data, err := MarshalExtendedHeader(h)
if err != nil {
// See the note under unmarshalling step
return msgID(pmsg.Data)
return mID(pmsg.Data)
}

return msgID(data)
return mID(data)
}

0 comments on commit c1960d8

Please sign in to comment.