From 9e301f0f9cc720e0737f55609daedc763a7de334 Mon Sep 17 00:00:00 2001 From: Peter Neuroth Date: Tue, 7 Oct 2025 12:44:11 +0200 Subject: [PATCH] lsp_plugin: rename cmds and opts to fit convention We use `experimental-*` for documented commands instead of `dev-` which are undocumented commands. Signed-off-by: Peter Neuroth --- plugins/lsps-plugin/src/client.rs | 2 +- plugins/lsps-plugin/src/lsps2/handler.rs | 10 ++--- plugins/lsps-plugin/src/lsps2/mod.rs | 4 +- tests/plugins/lsps2_policy.py | 8 ++-- tests/test_cln_lsps.py | 48 ++++++++++++------------ 5 files changed, 37 insertions(+), 35 deletions(-) diff --git a/plugins/lsps-plugin/src/client.rs b/plugins/lsps-plugin/src/client.rs index 1037bf550..fafa36c4c 100644 --- a/plugins/lsps-plugin/src/client.rs +++ b/plugins/lsps-plugin/src/client.rs @@ -30,7 +30,7 @@ use std::str::FromStr as _; /// An option to enable this service. const OPTION_ENABLED: options::FlagConfigOption = options::ConfigOption::new_flag( - "dev-lsps-client-enabled", + "experimental-lsps-client", "Enables an LSPS client on the node.", ); diff --git a/plugins/lsps-plugin/src/lsps2/handler.rs b/plugins/lsps-plugin/src/lsps2/handler.rs index 4b2d4f84f..c8e7168a9 100644 --- a/plugins/lsps-plugin/src/lsps2/handler.rs +++ b/plugins/lsps-plugin/src/lsps2/handler.rs @@ -95,10 +95,10 @@ impl ClnApi for ClnApiRpc { params: &Lsps2PolicyGetInfoRequest, ) -> AnyResult { let mut rpc = self.create_rpc().await?; - rpc.call_raw("dev-lsps2-getpolicy", params) + rpc.call_raw("lsps2-policy-getpolicy", params) .await .map_err(anyhow::Error::new) - .with_context(|| "calling dev-lsps2-getpolicy") + .with_context(|| "calling lsps2-policy-getpolicy") } async fn lsps2_getchannelcapacity( @@ -106,10 +106,10 @@ impl ClnApi for ClnApiRpc { params: &Lsps2PolicyGetChannelCapacityRequest, ) -> AnyResult { let mut rpc = self.create_rpc().await?; - rpc.call_raw("dev-lsps2-getchannelcapacity", params) + rpc.call_raw("lsps2-policy-getchannelcapacity", params) .await .map_err(anyhow::Error::new) - .with_context(|| "calling dev-lsps2-getchannelcapacity") + .with_context(|| "calling lsps2-policy-getchannelcapacity") } async fn cln_getinfo(&self, params: &GetinfoRequest) -> AnyResult { @@ -185,7 +185,7 @@ impl Lsps2GetInfoHandler { } } -/// The RequestHandler calls the internal rpc command `dev-lsps2-getinfo`. It +/// The RequestHandler calls the internal rpc command `lsps2-policy-getinfo`. It /// expects a plugin has registered this command and manages policies for the /// LSPS2 service. #[async_trait] diff --git a/plugins/lsps-plugin/src/lsps2/mod.rs b/plugins/lsps-plugin/src/lsps2/mod.rs index 2b98aa1df..60d8ebf5f 100644 --- a/plugins/lsps-plugin/src/lsps2/mod.rs +++ b/plugins/lsps-plugin/src/lsps2/mod.rs @@ -5,13 +5,13 @@ pub mod handler; pub mod model; pub const OPTION_ENABLED: options::FlagConfigOption = options::ConfigOption::new_flag( - "dev-lsps2-service-enabled", + "experimental-lsps2-service", "Enables lsps2 for the LSP service", ); pub const OPTION_PROMISE_SECRET: options::StringConfigOption = options::ConfigOption::new_str_no_default( - "dev-lsps2-promise-secret", + "experimental-lsps2-promise-secret", "A 64-character hex string that is the secret for promises", ); diff --git a/tests/plugins/lsps2_policy.py b/tests/plugins/lsps2_policy.py index 9294bbec7..d71fc6703 100755 --- a/tests/plugins/lsps2_policy.py +++ b/tests/plugins/lsps2_policy.py @@ -10,8 +10,8 @@ from datetime import datetime, timedelta, timezone plugin = Plugin() -@plugin.method("dev-lsps2-getpolicy") -def lsps2_getpolicy(request): +@plugin.method("lsps2-policy-getpolicy") +def lsps2_policy_getpolicy(request): """Returns an opening fee menu for the LSPS2 plugin.""" now = datetime.now(timezone.utc) @@ -42,8 +42,8 @@ def lsps2_getpolicy(request): } -@plugin.method("dev-lsps2-getchannelcapacity") -def lsps2_getchannelcapacity(request, init_payment_size, scid, opening_fee_params): +@plugin.method("lsps2-policy-getchannelcapacity") +def lsps2_policy_getchannelcapacity(request, init_payment_size, scid, opening_fee_params): """Returns an opening fee menu for the LSPS2 plugin.""" return {"channel_capacity_msat": 100000000} diff --git a/tests/test_cln_lsps.py b/tests/test_cln_lsps.py index 290a3e294..b353c513b 100644 --- a/tests/test_cln_lsps.py +++ b/tests/test_cln_lsps.py @@ -22,7 +22,14 @@ def test_lsps_service_disabled(node_factory): @unittest.skipUnless(RUST, 'RUST is not enabled') def test_lsps0_listprotocols(node_factory): l1, l2 = node_factory.get_nodes( - 2, opts=[{"dev-lsps-client-enabled": None}, {"dev-lsps-service-enabled": None}] + 2, + opts=[ + {"experimental-lsps-client": None}, + { + "experimental-lsps2-service": None, + "experimental-lsps2-promise-secret": "0" * 64, + }, + ], ) # We don't need a channel to query for lsps services @@ -36,11 +43,10 @@ def test_lsps2_enabled(node_factory): l1, l2 = node_factory.get_nodes( 2, opts=[ - {"dev-lsps-client-enabled": None}, + {"experimental-lsps-client": None}, { - "dev-lsps-service-enabled": None, - "dev-lsps2-service-enabled": None, - "dev-lsps2-promise-secret": "0" * 64, + "experimental-lsps2-service": None, + "experimental-lsps2-promise-secret": "0" * 64, }, ], ) @@ -57,14 +63,13 @@ def test_lsps2_getinfo(node_factory): l1, l2 = node_factory.get_nodes( 2, opts=[ - {"dev-lsps-client-enabled": None}, + {"experimental-lsps-client": None}, { - "dev-lsps-service-enabled": None, - "dev-lsps2-service-enabled": None, - "dev-lsps2-promise-secret": "0" * 64, + "experimental-lsps2-service": None, + "experimental-lsps2-promise-secret": "0" * 64, "plugin": plugin, }, - ], + ] ) node_factory.join_nodes([l1, l2], fundchannel=False) @@ -80,14 +85,13 @@ def test_lsps2_buy(node_factory): l1, l2 = node_factory.get_nodes( 2, opts=[ - {"dev-lsps-client-enabled": None}, + {"experimental-lsps-client": None}, { - "dev-lsps-service-enabled": None, - "dev-lsps2-service-enabled": None, - "dev-lsps2-promise-secret": "0" * 64, + "experimental-lsps2-service": None, + "experimental-lsps2-promise-secret": "0" * 64, "plugin": plugin, }, - ], + ] ) # We don't need a channel to query for lsps services @@ -123,11 +127,10 @@ def test_lsps2_buyjitchannel_no_mpp_var_invoice(node_factory, bitcoind): l1, l2, l3 = node_factory.get_nodes( 3, opts=[ - {"dev-lsps-client-enabled": None}, + {"experimental-lsps-client": None}, { - "dev-lsps-service-enabled": None, - "dev-lsps2-service-enabled": None, - "dev-lsps2-promise-secret": "00" * 32, + "experimental-lsps2-service": None, + "experimental-lsps2-promise-secret": "0" * 64, "plugin": plugin, "fee-base": 0, # We are going to deduct our fee anyways, "fee-per-satoshi": 0, # We are going to deduct our fee anyways, @@ -199,11 +202,10 @@ def test_lsps2_non_approved_zero_conf(node_factory, bitcoind): l1, l2, l3 = node_factory.get_nodes( 3, opts=[ - {"dev-lsps-client-enabled": None}, + {"experimental-lsps-client": None}, { - "dev-lsps-service-enabled": None, - "dev-lsps2-service-enabled": None, - "dev-lsps2-promise-secret": "00" * 32, + "experimental-lsps2-service": None, + "experimental-lsps2-promise-secret": "0" * 64, "plugin": plugin, "fee-base": 0, # We are going to deduct our fee anyways, "fee-per-satoshi": 0, # We are going to deduct our fee anyways,