MCPcopy Create free account
hub / github.com/DeAI-Artist/Linkis / Hash

Method Hash

types/block.go:894–912  ·  view source on GitHub ↗

Hash returns the hash of the commit

()

Source from the content-addressed store, hash-verified

892
893// Hash returns the hash of the commit
894func (commit *Commit) Hash() tmbytes.HexBytes {
895 if commit == nil {
896 return nil
897 }
898 if commit.hash == nil {
899 bs := make([][]byte, len(commit.Signatures))
900 for i, commitSig := range commit.Signatures {
901 pbcs := commitSig.ToProto()
902 bz, err := pbcs.Marshal()
903 if err != nil {
904 panic(err)
905 }
906
907 bs[i] = bz
908 }
909 commit.hash = merkle.HashFromByteSlices(bs)
910 }
911 return commit.hash
912}
913
914// StringIndented returns a string representation of the commit.
915func (commit *Commit) StringIndented(indent string) string {

Callers

nothing calls this directly

Calls 3

HashFromByteSlicesFunction · 0.92
ToProtoMethod · 0.45
MarshalMethod · 0.45

Tested by

no test coverage detected