| 170 | } |
| 171 | |
| 172 | async fn handle_notification(plugin: Plugin<PluginState>, value: serde_json::Value) -> Result<()> { |
| 173 | let notification: Result<Notification, _> = serde_json::from_value(value); |
| 174 | match notification { |
| 175 | Err(err) => { |
| 176 | log::debug!("Failed to parse notification from lightningd {:?}", err); |
| 177 | } |
| 178 | Ok(notification) => { |
| 179 | /* Depending on whether or not there is a wildcard |
| 180 | * subscription we may receive notifications for which we |
| 181 | * don't have a handler. We suppress the `SendError` which |
| 182 | * would indicate there is no subscriber for the given |
| 183 | * topic. */ |
| 184 | let _ = plugin.state().events.send(notification); |
| 185 | } |
| 186 | }; |
| 187 | Ok(()) |
| 188 | } |
| 189 | |
| 190 | fn log_error(error: String) { |
| 191 | println!( |