MCPcopy Create free account
hub / github.com/tendermint/tendermint / checkEvidenceKey

Function checkEvidenceKey

scripts/keymigrate/migrate.go:530–536  ·  view source on GitHub ↗

checkEvidenceKey reports whether a candidate key with one of the legacy evidence prefixes has the correct structure for a legacy evidence key. This check is needed because transaction hashes are stored without a prefix, so checking the one-byte prefix alone is not enough to distinguish them. Legacy

(key keyID)

Source from the content-addressed store, hash-verified

528// where the first element is the height and the second is the hash. Thus, we
529// check
530func checkEvidenceKey(key keyID) bool {
531 parts := bytes.SplitN(key[1:], []byte("/"), 2)
532 if len(parts) != 2 || len(parts[0]) != 16 || !isHex(parts[0]) || !isHex(parts[1]) {
533 return false
534 }
535 return true
536}
537
538func isHex(data []byte) bool {
539 for _, b := range data {

Callers

nothing calls this directly

Calls 1

isHexFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…