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

Function validateBlockID

ethstorage/archiver/utils.go:18–23  ·  view source on GitHub ↗
(id string)

Source from the content-addressed store, hash-verified

16var knownIds = []string{"genesis", "finalized", "head"}
17
18func 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
25func isHash(s string) bool {
26 if len(s) != 66 || !strings.HasPrefix(s, "0x") {

Callers 2

blobSidecarHandlerMethod · 0.85
blobsHandlerMethod · 0.85

Calls 4

isHashFunction · 0.85
isSlotFunction · 0.85
newBadRequestErrorFunction · 0.85
ContainsMethod · 0.45

Tested by

no test coverage detected