MCPcopy
hub / github.com/canopy-network/canopy / BytesToTruncatedString

Function BytesToTruncatedString

lib/util.go:556–564  ·  view source on GitHub ↗

BytesToTruncatedString() converts a byte slice to a truncated hexadecimal string

(b []byte)

Source from the content-addressed store, hash-verified

554
555// BytesToTruncatedString() converts a byte slice to a truncated hexadecimal string
556func BytesToTruncatedString(b []byte) string {
557 // if the bytes are LTE the truncation
558 if len(b) <= 10 {
559 // simply return the string version
560 return hex.EncodeToString(b)
561 }
562 // return the truncated string version
563 return hex.EncodeToString(b[:10])
564}
565
566// PublicKeyFromBytes() converts a byte slice into a BLS public key
567func PublicKeyFromBytes(pubKey []byte) (crypto.PublicKeyI, ErrorI) {

Callers 15

SyncMethod · 0.92
sendBlockRequestsMethod · 0.92
verifyResponseMethod · 0.92
RequestBlockMethod · 0.92
pollMaxHeightMethod · 0.92
ListenForTxMethod · 0.92
ListenForBlockMethod · 0.92
CommitCertificateMethod · 0.92
sendMethod · 0.92
SendMethod · 0.92

Calls

no outgoing calls

Tested by 1