MCPcopy Index your code
hub / github.com/CovenantSQL/CovenantSQL / GetBlockV3

Method GetBlockV3

sqlchain/observer/api.go:195–219  ·  view source on GitHub ↗
(rw http.ResponseWriter, r *http.Request)

Source from the content-addressed store, hash-verified

193}
194
195func (a *explorerAPI) GetBlockV3(rw http.ResponseWriter, r *http.Request) {
196 vars := mux.Vars(r)
197
198 dbID, err := a.getDBID(vars)
199 if err != nil {
200 sendResponse(400, false, err, nil, rw)
201 return
202 }
203
204 h, err := a.getHash(vars)
205 if err != nil {
206 sendResponse(400, false, err, nil, rw)
207 return
208 }
209
210 count, height, block, err := a.service.getBlock(dbID, h)
211 if err != nil {
212 sendResponse(500, false, err, nil, rw)
213 return
214 }
215
216 op := newPaginationFromReq(r)
217
218 sendResponse(200, true, "", a.formatBlockV3(count, height, block, op), rw)
219}
220
221func (a *explorerAPI) GetBlockByCount(rw http.ResponseWriter, r *http.Request) {
222 vars := mux.Vars(r)

Callers

nothing calls this directly

Calls 6

getDBIDMethod · 0.95
getHashMethod · 0.95
formatBlockV3Method · 0.95
newPaginationFromReqFunction · 0.85
getBlockMethod · 0.80
sendResponseFunction · 0.70

Tested by

no test coverage detected