MCPcopy Create free account
hub / github.com/ElementsProject/lightning / run_interface

Function run_interface

plugins/grpc-plugin/src/main.rs:143–170  ·  view source on GitHub ↗
(bind_addr: SocketAddr, state: PluginState)

Source from the content-addressed store, hash-verified

141}
142
143async fn run_interface(bind_addr: SocketAddr, state: PluginState) -> Result<()> {
144 let identity = state.identity.to_tonic_identity();
145 let ca_cert = tonic::transport::Certificate::from_pem(state.ca_cert);
146
147 let tls = tonic::transport::ServerTlsConfig::new()
148 .identity(identity)
149 .client_ca_root(ca_cert);
150
151 let server = tonic::transport::Server::builder()
152 .tls_config(tls)
153 .context("configuring tls")?
154 .add_service(NodeServer::new(
155 cln_grpc::Server::new(&state.rpc_path, state.events.clone())
156 .await
157 .context("creating NodeServer instance")?,
158 ))
159 .serve(bind_addr);
160
161 log::info!(
162 "Connecting to {:?} and serving grpc on {:?}",
163 &state.rpc_path,
164 &bind_addr
165 );
166
167 server.await.context("serving requests")?;
168
169 Ok(())
170}
171
172async fn handle_notification(plugin: Plugin<PluginState>, value: serde_json::Value) -> Result<()> {
173 let notification: Result<Notification, _> = serde_json::from_value(value);

Callers

nothing calls this directly

Calls 1

to_tonic_identityMethod · 0.80

Tested by

no test coverage detected