| 27 | impl Node for Server |
| 28 | { |
| 29 | async fn getinfo( |
| 30 | &self, |
| 31 | request: tonic::Request<pb::GetinfoRequest>, |
| 32 | ) -> Result<tonic::Response<pb::GetinfoResponse>, tonic::Status> { |
| 33 | let req = request.into_inner(); |
| 34 | let req: requests::GetinfoRequest = req.into(); |
| 35 | debug!("Client asked for getinfo"); |
| 36 | trace!("getinfo request: {:?}", req); |
| 37 | let mut rpc = ClnRpc::new(&self.rpc_path) |
| 38 | .await |
| 39 | .map_err(|e| Status::new(Code::Internal, e.to_string()))?; |
| 40 | let result = rpc.call(Request::Getinfo(req)) |
| 41 | .await |
| 42 | .map_err(|e| Status::new( |
| 43 | Code::Unknown, |
| 44 | format!("Error calling method Getinfo: {:?}", e)))?; |
| 45 | match result { |
| 46 | Response::Getinfo(r) => { |
| 47 | trace!("getinfo response: {:?}", r); |
| 48 | Ok(tonic::Response::new(r.into())) |
| 49 | }, |
| 50 | r => Err(Status::new( |
| 51 | Code::Internal, |
| 52 | format!( |
| 53 | "Unexpected result {:?} to method call Getinfo", |
| 54 | r |
| 55 | ) |
| 56 | )), |
| 57 | } |
| 58 | |
| 59 | } |
| 60 | |
| 61 | async fn list_peers( |
| 62 | &self, |