| 155 | } |
| 156 | |
| 157 | async fn list_channels( |
| 158 | &self, |
| 159 | request: tonic::Request<pb::ListchannelsRequest>, |
| 160 | ) -> Result<tonic::Response<pb::ListchannelsResponse>, tonic::Status> { |
| 161 | let req = request.into_inner(); |
| 162 | let req: requests::ListchannelsRequest = req.into(); |
| 163 | debug!("Client asked for list_channels"); |
| 164 | trace!("list_channels request: {:?}", req); |
| 165 | let mut rpc = ClnRpc::new(&self.rpc_path) |
| 166 | .await |
| 167 | .map_err(|e| Status::new(Code::Internal, e.to_string()))?; |
| 168 | let result = rpc.call(Request::ListChannels(req)) |
| 169 | .await |
| 170 | .map_err(|e| Status::new( |
| 171 | Code::Unknown, |
| 172 | format!("Error calling method ListChannels: {:?}", e)))?; |
| 173 | match result { |
| 174 | Response::ListChannels(r) => { |
| 175 | trace!("list_channels response: {:?}", r); |
| 176 | Ok(tonic::Response::new(r.into())) |
| 177 | }, |
| 178 | r => Err(Status::new( |
| 179 | Code::Internal, |
| 180 | format!( |
| 181 | "Unexpected result {:?} to method call ListChannels", |
| 182 | r |
| 183 | ) |
| 184 | )), |
| 185 | } |
| 186 | |
| 187 | } |
| 188 | |
| 189 | async fn add_gossip( |
| 190 | &self, |