RootChainInfo retrieves the root chain info for the specified chain
(w http.ResponseWriter, r *http.Request, _ httprouter.Params)
| 136 | |
| 137 | // RootChainInfo retrieves the root chain info for the specified chain |
| 138 | func (s *Server) RootChainInfo(w http.ResponseWriter, r *http.Request, _ httprouter.Params) { |
| 139 | req := new(heightAndIdRequest) |
| 140 | // unmarshal request parameters |
| 141 | if ok := unmarshal(w, r, req); !ok { |
| 142 | return |
| 143 | } |
| 144 | // if height is 0; set to the latest height |
| 145 | if req.Height == 0 { |
| 146 | req.Height = s.controller.FSM.Height() |
| 147 | } |
| 148 | // load the root chain info directly |
| 149 | got, err := s.controller.FSM.LoadRootChainInfo(req.ID, req.Height) |
| 150 | if err != nil { |
| 151 | write(w, err, http.StatusBadRequest) |
| 152 | return |
| 153 | } |
| 154 | write(w, got, http.StatusOK) |
| 155 | } |
| 156 | |
| 157 | // CommitteeData retrieves the committee data for the specified chain id |
| 158 | func (s *Server) CommitteeData(w http.ResponseWriter, r *http.Request, _ httprouter.Params) { |
no test coverage detected