(id string)
| 16 | var knownIds = []string{"genesis", "finalized", "head"} |
| 17 | |
| 18 | func validateBlockID(id string) *httpError { |
| 19 | if isHash(id) || isSlot(id) || slices.Contains(knownIds, id) { |
| 20 | return nil |
| 21 | } |
| 22 | return newBadRequestError(fmt.Sprintf("Invalid block ID: %s", id)) |
| 23 | } |
| 24 | |
| 25 | func isHash(s string) bool { |
| 26 | if len(s) != 66 || !strings.HasPrefix(s, "0x") { |
no test coverage detected