MCPcopy Create free account
hub / github.com/ethstorage/es-node / CompareCommits

Function CompareCommits

ethstorage/storage_manager.go:39–57  ·  view source on GitHub ↗
(expected, found []byte)

Source from the content-addressed store, hash-verified

37}
38
39func CompareCommits(expected, found []byte) error {
40 if len(expected) < HashSizeInContract {
41 return &CommitMismatchError{
42 message: fmt.Sprintf("invalid length of commit %x: %d", expected, len(expected)),
43 }
44 }
45 if len(found) < HashSizeInContract {
46 return &CommitMismatchError{
47 message: fmt.Sprintf("invalid length of commit %x: %d", found, len(found)),
48 }
49 }
50 if bytes.Equal(expected[0:HashSizeInContract], found[0:HashSizeInContract]) {
51 return nil
52 }
53 return &CommitMismatchError{
54 expected: expected[0:HashSizeInContract],
55 found: found[0:HashSizeInContract],
56 }
57}
58
59type FetchBlobFunc func(kvIndex uint64, hash common.Hash) ([]byte, error)
60

Callers 5

FetchBlobMethod · 0.92
GetBlobMethod · 0.92
commitEncodedBlobMethod · 0.85
checkMetaMethod · 0.85
checkCommitFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected