From 6bac381a3fe42e3327b4508d9103329b267130d3 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Sun, 17 Aug 2025 09:39:35 +0930 Subject: [PATCH] cln-plugin: adapt send_custom_notification to send modern-style notifications. Modern style for notifications is to put everything inside an object of same name as the method. For now this means duplication for backward compatibility. ChatGPT helped me do that. Signed-off-by: Rusty Russell --- plugins/src/lib.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/plugins/src/lib.rs b/plugins/src/lib.rs index 112459aed..dc9cf1ab5 100644 --- a/plugins/src/lib.rs +++ b/plugins/src/lib.rs @@ -876,11 +876,19 @@ where method: String, v: serde_json::Value, ) -> Result<(), Error> { + // Modern has them inside object of same name. + // This is deprecated, scheduled for removal 26.09. + let mut params = match &v { + serde_json::Value::Object(map) => map.clone(), + _ => return Err(anyhow::anyhow!("params must be a JSON object")), + }; + params.insert(method.clone(), json!(v)); + self.sender .send(json!({ "jsonrpc": "2.0", "method": method, - "params": v, + "params": params, })) .await .context("sending custom notification")?;