Skip to content

Commit 9f2841a

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 <pet.v.ne@gmail.com>
1 parent 9b4f165 commit 9f2841a

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
@@ -22,7 +22,14 @@ def test_lsps_service_disabled(node_factory):
2222
@unittest.skipUnless(RUST, 'RUST is not enabled')
2323
def test_lsps0_listprotocols(node_factory):
2424
l1, l2 = node_factory.get_nodes(
25-
2, opts=[{"dev-lsps-client-enabled": None}, {"dev-lsps-service-enabled": None}]
25+
2,
26+
opts=[
27+
{"experimental-lsps-client": None},
28+
{
29+
"experimental-lsps2-service": None,
30+
"experimental-lsps2-promise-secret": "0" * 64,
31+
},
32+
],
2633
)
2734

2835
# We don't need a channel to query for lsps services
@@ -36,11 +43,10 @@ def test_lsps2_enabled(node_factory):
3643
l1, l2 = node_factory.get_nodes(
3744
2,
3845
opts=[
39-
{"dev-lsps-client-enabled": None},
46+
{"experimental-lsps-client": None},
4047
{
41-
"dev-lsps-service-enabled": None,
42-
"dev-lsps2-service-enabled": None,
43-
"dev-lsps2-promise-secret": "0" * 64,
48+
"experimental-lsps2-service": None,
49+
"experimental-lsps2-promise-secret": "0" * 64,
4450
},
4551
],
4652
)
@@ -57,14 +63,13 @@ def test_lsps2_getinfo(node_factory):
5763
l1, l2 = node_factory.get_nodes(
5864
2,
5965
opts=[
60-
{"dev-lsps-client-enabled": None},
66+
{"experimental-lsps-client": None},
6167
{
62-
"dev-lsps-service-enabled": None,
63-
"dev-lsps2-service-enabled": None,
64-
"dev-lsps2-promise-secret": "0" * 64,
68+
"experimental-lsps2-service": None,
69+
"experimental-lsps2-promise-secret": "0" * 64,
6570
"plugin": plugin,
6671
},
67-
],
72+
]
6873
)
6974

7075
node_factory.join_nodes([l1, l2], fundchannel=False)
@@ -80,14 +85,13 @@ def test_lsps2_buy(node_factory):
8085
l1, l2 = node_factory.get_nodes(
8186
2,
8287
opts=[
83-
{"dev-lsps-client-enabled": None},
88+
{"experimental-lsps-client": None},
8489
{
85-
"dev-lsps-service-enabled": None,
86-
"dev-lsps2-service-enabled": None,
87-
"dev-lsps2-promise-secret": "0" * 64,
90+
"experimental-lsps2-service": None,
91+
"experimental-lsps2-promise-secret": "0" * 64,
8892
"plugin": plugin,
8993
},
90-
],
94+
]
9195
)
9296

9397
# 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):
123127
l1, l2, l3 = node_factory.get_nodes(
124128
3,
125129
opts=[
126-
{"dev-lsps-client-enabled": None},
130+
{"experimental-lsps-client": None},
127131
{
128-
"dev-lsps-service-enabled": None,
129-
"dev-lsps2-service-enabled": None,
130-
"dev-lsps2-promise-secret": "00" * 32,
132+
"experimental-lsps2-service": None,
133+
"experimental-lsps2-promise-secret": "0" * 64,
131134
"plugin": plugin,
132135
"fee-base": 0, # We are going to deduct our fee anyways,
133136
"fee-per-satoshi": 0, # We are going to deduct our fee anyways,
@@ -148,7 +151,7 @@ def test_lsps2_buyjitchannel_no_mpp_var_invoice(node_factory, bitcoind):
148151
"short_channel_id"
149152
]
150153

151-
inv = l1.rpc.lsps_jitchannel(
154+
inv = l1.rpc.lsps_lsps2_invoice(
152155
lsp_id=l2.info["id"],
153156
amount_msat="any",
154157
description="lsp-jit-channel-0",
@@ -199,11 +202,10 @@ def test_lsps2_non_approved_zero_conf(node_factory, bitcoind):
199202
l1, l2, l3 = node_factory.get_nodes(
200203
3,
201204
opts=[
202-
{"dev-lsps-client-enabled": None},
205+
{"experimental-lsps-client": None},
203206
{
204-
"dev-lsps-service-enabled": None,
205-
"dev-lsps2-service-enabled": None,
206-
"dev-lsps2-promise-secret": "00" * 32,
207+
"experimental-lsps2-service": None,
208+
"experimental-lsps2-promise-secret": "0" * 64,
207209
"plugin": plugin,
208210
"fee-base": 0, # We are going to deduct our fee anyways,
209211
"fee-per-satoshi": 0, # We are going to deduct our fee anyways,

0 commit comments

Comments
 (0)