MCPcopy
hub / github.com/canopy-network/canopy / ConsensusInfo

Method ConsensusInfo

cmd/rpc/admin.go:487–502  ·  view source on GitHub ↗

ConsensusInfo retrieves node consensus information

(w http.ResponseWriter, r *http.Request, _ httprouter.Params)

Source from the content-addressed store, hash-verified

485
486// ConsensusInfo retrieves node consensus information
487func (s *Server) ConsensusInfo(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {
488 if err := r.ParseForm(); err != nil {
489 write(w, err, http.StatusBadRequest)
490 return
491 }
492 summary, err := s.controller.ConsensusSummary()
493 if err != nil {
494 write(w, err, http.StatusInternalServerError)
495 return
496 }
497 w.Header().Set(ContentType, ApplicationJSON)
498 w.WriteHeader(http.StatusOK)
499 if _, e := w.Write(summary); e != nil {
500 s.logger.Error(e.Error())
501 }
502}
503
504// PeerInfo retrieves node peer information
505func (s *Server) PeerInfo(w http.ResponseWriter, _ *http.Request, _ httprouter.Params) {

Callers

nothing calls this directly

Calls 5

writeFunction · 0.85
ConsensusSummaryMethod · 0.80
WriteMethod · 0.80
SetMethod · 0.65
ErrorMethod · 0.65

Tested by

no test coverage detected