(rw http.ResponseWriter, r *http.Request)
| 285 | } |
| 286 | |
| 287 | func (a *explorerAPI) GetBlockByHeight(rw http.ResponseWriter, r *http.Request) { |
| 288 | vars := mux.Vars(r) |
| 289 | |
| 290 | dbID, err := a.getDBID(vars) |
| 291 | if err != nil { |
| 292 | sendResponse(400, false, err, nil, rw) |
| 293 | return |
| 294 | } |
| 295 | |
| 296 | heightStr := vars["height"] |
| 297 | if heightStr == "" { |
| 298 | sendResponse(400, false, "empty height", nil, rw) |
| 299 | return |
| 300 | } |
| 301 | |
| 302 | heightNumber, err := strconv.ParseInt(heightStr, 10, 32) |
| 303 | if err != nil { |
| 304 | sendResponse(400, false, err, nil, rw) |
| 305 | return |
| 306 | } |
| 307 | |
| 308 | height := int32(heightNumber) |
| 309 | |
| 310 | _, block, err := a.service.getBlockByHeight(dbID, height) |
| 311 | if err != nil { |
| 312 | sendResponse(500, false, err, nil, rw) |
| 313 | return |
| 314 | } |
| 315 | |
| 316 | sendResponse(200, true, "", a.formatBlock(height, block), rw) |
| 317 | } |
| 318 | |
| 319 | func (a *explorerAPI) GetBlockByHeightV3(rw http.ResponseWriter, r *http.Request) { |
| 320 | vars := mux.Vars(r) |
nothing calls this directly
no test coverage detected