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)
| 528 | // where the first element is the height and the second is the hash. Thus, we |
| 529 | // check |
| 530 | func 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 | |
| 538 | func isHex(data []byte) bool { |
| 539 | for _, b := range data { |
nothing calls this directly
no test coverage detected
searching dependent graphs…