| 2710 | } |
| 2711 | |
| 2712 | async fn plugin( |
| 2713 | &self, |
| 2714 | request: tonic::Request<pb::PluginRequest>, |
| 2715 | ) -> Result<tonic::Response<pb::PluginResponse>, tonic::Status> { |
| 2716 | let req = request.into_inner(); |
| 2717 | let req: requests::PluginRequest = req.try_into()?; |
| 2718 | debug!("Client asked for plugin"); |
| 2719 | trace!("plugin request: {:?}", req); |
| 2720 | let mut rpc = ClnRpc::new(&self.rpc_path) |
| 2721 | .await |
| 2722 | .map_err(|e| Status::new(Code::Internal, e.to_string()))?; |
| 2723 | let result = rpc.call(Request::Plugin(req)) |
| 2724 | .await |
| 2725 | .map_err(|e| Status::new( |
| 2726 | Code::Unknown, |
| 2727 | format!("Error calling method Plugin: {:?}", e)))?; |
| 2728 | match result { |
| 2729 | Response::Plugin(r) => { |
| 2730 | trace!("plugin response: {:?}", r); |
| 2731 | Ok(tonic::Response::new(r.into())) |
| 2732 | }, |
| 2733 | r => Err(Status::new( |
| 2734 | Code::Internal, |
| 2735 | format!( |
| 2736 | "Unexpected result {:?} to method call Plugin", |
| 2737 | r |
| 2738 | ) |
| 2739 | )), |
| 2740 | } |
| 2741 | |
| 2742 | } |
| 2743 | |
| 2744 | async fn rene_pay_status( |
| 2745 | &self, |