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

Function handle_notification

plugins/rest-plugin/src/handlers.rs:545–559  ·  view source on GitHub ↗
(
    plugin: Plugin<PluginState>,
    value: serde_json::Value,
)

Source from the content-addressed store, hash-verified

543}
544
545pub async fn handle_notification(
546 plugin: Plugin<PluginState>,
547 value: serde_json::Value,
548) -> Result<(), anyhow::Error> {
549 if let Some(sht) = value.get("shutdown") {
550 log::info!("Got shutdown notification: {}", sht);
551 /* This seems to error when subscribing to "*" notifications */
552 _ = plugin.shutdown();
553 process::exit(0);
554 }
555 match plugin.state().notification_sender.send(value).await {
556 Ok(()) => Ok(()),
557 Err(e) => Err(anyhow!("Error sending notification: {}", e)),
558 }
559}
560
561pub async fn swagger_redirect_middleware(
562 Extension(swagger_path): Extension<String>,

Callers

nothing calls this directly

Calls 4

stateMethod · 0.80
getMethod · 0.45
shutdownMethod · 0.45
sendMethod · 0.45

Tested by

no test coverage detected