Skip to content

Commit 5877b11

Browse files
committed
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 <[email protected]>
1 parent 0895e65 commit 5877b11

File tree

5 files changed

+39
-37
lines changed

5 files changed

+39
-37
lines changed

plugins/lsps-plugin/src/client.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ use std::str::FromStr as _;
3030

3131
/// An option to enable this service.
3232
const OPTION_ENABLED: options::FlagConfigOption = options::ConfigOption::new_flag(
33-
"dev-lsps-client-enabled",
33+
"experimental-lsps-client",
3434
"Enables an LSPS client on the node.",
3535
);
3636

@@ -74,7 +74,7 @@ async fn main() -> Result<(), anyhow::Error> {
7474
on_lsps_lsps2_approve,
7575
)
7676
.rpcmethod(
77-
"lsps-jitchannel",
77+
"lsps-lsps2-invoice",
7878
"Requests a new jit channel from LSP and returns the matching invoice",
7979
on_lsps_jitchannel,
8080
)

plugins/lsps-plugin/src/lsps2/handler.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,21 +95,21 @@ impl ClnApi for ClnApiRpc {
9595
params: &Lsps2PolicyGetInfoRequest,
9696
) -> AnyResult<Lsps2PolicyGetInfoResponse> {
9797
let mut rpc = self.create_rpc().await?;
98-
rpc.call_raw("dev-lsps2-getpolicy", params)
98+
rpc.call_raw("lsps2-policy-getpolicy", params)
9999
.await
100100
.map_err(anyhow::Error::new)
101-
.with_context(|| "calling dev-lsps2-getpolicy")
101+
.with_context(|| "calling lsps2-policy-getpolicy")
102102
}
103103

104104
async fn lsps2_getchannelcapacity(
105105
&self,
106106
params: &Lsps2PolicyGetChannelCapacityRequest,
107107
) -> AnyResult<Lsps2PolicyGetChannelCapacityResponse> {
108108
let mut rpc = self.create_rpc().await?;
109-
rpc.call_raw("dev-lsps2-getchannelcapacity", params)
109+
rpc.call_raw("lsps2-policy-getchannelcapacity", params)
110110
.await
111111
.map_err(anyhow::Error::new)
112-
.with_context(|| "calling dev-lsps2-getchannelcapacity")
112+
.with_context(|| "calling lsps2-policy-getchannelcapacity")
113113
}
114114

115115
async fn cln_getinfo(&self, params: &GetinfoRequest) -> AnyResult<GetinfoResponse> {
@@ -185,7 +185,7 @@ impl<A: ClnApi> Lsps2GetInfoHandler<A> {
185185
}
186186
}
187187

188-
/// The RequestHandler calls the internal rpc command `dev-lsps2-getinfo`. It
188+
/// The RequestHandler calls the internal rpc command `lsps2-policy-getinfo`. It
189189
/// expects a plugin has registered this command and manages policies for the
190190
/// LSPS2 service.
191191
#[async_trait]

plugins/lsps-plugin/src/lsps2/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ pub mod handler;
55
pub mod model;
66

77
pub const OPTION_ENABLED: options::FlagConfigOption = options::ConfigOption::new_flag(
8-
"dev-lsps2-service-enabled",
8+
"experimental-lsps2-service",
99
"Enables lsps2 for the LSP service",
1010
);
1111

1212
pub const OPTION_PROMISE_SECRET: options::StringConfigOption =
1313
options::ConfigOption::new_str_no_default(
14-
"dev-lsps2-promise-secret",
14+
"experimental-lsps2-promise-secret",
1515
"A 64-character hex string that is the secret for promises",
1616
);
1717

tests/plugins/lsps2_policy.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
plugin = Plugin()
1111

1212

13-
@plugin.method("dev-lsps2-getpolicy")
14-
def lsps2_getpolicy(request):
13+
@plugin.method("lsps2-policy-getpolicy")
14+
def lsps2_policy_getpolicy(request):
1515
"""Returns an opening fee menu for the LSPS2 plugin."""
1616
now = datetime.now(timezone.utc)
1717

@@ -42,8 +42,8 @@ def lsps2_getpolicy(request):
4242
}
4343

4444

45-
@plugin.method("dev-lsps2-getchannelcapacity")
46-
def lsps2_getchannelcapacity(request, init_payment_size, scid, opening_fee_params):
45+
@plugin.method("lsps2-policy-getchannelcapacity")
46+
def lsps2_policy_getchannelcapacity(request, init_payment_size, scid, opening_fee_params):
4747
"""Returns an opening fee menu for the LSPS2 plugin."""
4848
return {"channel_capacity_msat": 100000000}
4949

tests/test_cln_lsps.py

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,14 @@ def test_lsps_service_disabled(node_factory):
2020
@unittest.skipUnless(RUST, 'RUST is not enabled')
2121
def test_lsps0_listprotocols(node_factory):
2222
l1, l2 = node_factory.get_nodes(
23-
2, opts=[{"dev-lsps-client-enabled": None}, {"dev-lsps-service-enabled": None}]
23+
2,
24+
opts=[
25+
{"experimental-lsps-client": None},
26+
{
27+
"experimental-lsps2-service": None,
28+
"experimental-lsps2-promise-secret": "0" * 64,
29+
},
30+
],
2431
)
2532

2633
# We don't need a channel to query for lsps services
@@ -34,11 +41,10 @@ def test_lsps2_enabled(node_factory):
3441
l1, l2 = node_factory.get_nodes(
3542
2,
3643
opts=[
37-
{"dev-lsps-client-enabled": None},
44+
{"experimental-lsps-client": None},
3845
{
39-
"dev-lsps-service-enabled": None,
40-
"dev-lsps2-service-enabled": None,
41-
"dev-lsps2-promise-secret": "0" * 64,
46+
"experimental-lsps2-service": None,
47+
"experimental-lsps2-promise-secret": "0" * 64,
4248
},
4349
],
4450
)
@@ -55,14 +61,13 @@ def test_lsps2_getinfo(node_factory):
5561
l1, l2 = node_factory.get_nodes(
5662
2,
5763
opts=[
58-
{"dev-lsps-client-enabled": None},
64+
{"experimental-lsps-client": None},
5965
{
60-
"dev-lsps-service-enabled": None,
61-
"dev-lsps2-service-enabled": None,
62-
"dev-lsps2-promise-secret": "0" * 64,
66+
"experimental-lsps2-service": None,
67+
"experimental-lsps2-promise-secret": "0" * 64,
6368
"plugin": plugin,
6469
},
65-
],
70+
]
6671
)
6772

6873
node_factory.join_nodes([l1, l2], fundchannel=False)
@@ -78,14 +83,13 @@ def test_lsps2_buy(node_factory):
7883
l1, l2 = node_factory.get_nodes(
7984
2,
8085
opts=[
81-
{"dev-lsps-client-enabled": None},
86+
{"experimental-lsps-client": None},
8287
{
83-
"dev-lsps-service-enabled": None,
84-
"dev-lsps2-service-enabled": None,
85-
"dev-lsps2-promise-secret": "0" * 64,
88+
"experimental-lsps2-service": None,
89+
"experimental-lsps2-promise-secret": "0" * 64,
8690
"plugin": plugin,
8791
},
88-
],
92+
]
8993
)
9094

9195
# We don't need a channel to query for lsps services
@@ -121,11 +125,10 @@ def test_lsps2_buyjitchannel_no_mpp_var_invoice(node_factory, bitcoind):
121125
l1, l2, l3 = node_factory.get_nodes(
122126
3,
123127
opts=[
124-
{"dev-lsps-client-enabled": None},
128+
{"experimental-lsps-client": None},
125129
{
126-
"dev-lsps-service-enabled": None,
127-
"dev-lsps2-service-enabled": None,
128-
"dev-lsps2-promise-secret": "00" * 32,
130+
"experimental-lsps2-service": None,
131+
"experimental-lsps2-promise-secret": "0" * 64,
129132
"plugin": plugin,
130133
"fee-base": 0, # We are going to deduct our fee anyways,
131134
"fee-per-satoshi": 0, # We are going to deduct our fee anyways,
@@ -146,7 +149,7 @@ def test_lsps2_buyjitchannel_no_mpp_var_invoice(node_factory, bitcoind):
146149
"short_channel_id"
147150
]
148151

149-
inv = l1.rpc.lsps_jitchannel(
152+
inv = l1.rpc.lsps_lsps2_invoice(
150153
lsp_id=l2.info["id"],
151154
amount_msat="any",
152155
description="lsp-jit-channel-0",
@@ -197,11 +200,10 @@ def test_lsps2_non_approved_zero_conf(node_factory, bitcoind):
197200
l1, l2, l3 = node_factory.get_nodes(
198201
3,
199202
opts=[
200-
{"dev-lsps-client-enabled": None},
203+
{"experimental-lsps-client": None},
201204
{
202-
"dev-lsps-service-enabled": None,
203-
"dev-lsps2-service-enabled": None,
204-
"dev-lsps2-promise-secret": "00" * 32,
205+
"experimental-lsps2-service": None,
206+
"experimental-lsps2-promise-secret": "0" * 64,
205207
"plugin": plugin,
206208
"fee-base": 0, # We are going to deduct our fee anyways,
207209
"fee-per-satoshi": 0, # We are going to deduct our fee anyways,

0 commit comments

Comments
 (0)