Skip to content

Commit 3cfd280

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 db765b4 commit 3cfd280

5 files changed

Lines changed: 39 additions & 37 deletions

File tree

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
@@ -19,7 +19,14 @@ def test_lsps_service_disabled(node_factory):
1919

2020
def test_lsps0_listprotocols(node_factory):
2121
l1, l2 = node_factory.get_nodes(
22-
2, opts=[{"dev-lsps-client-enabled": None}, {"dev-lsps-service-enabled": None}]
22+
2,
23+
opts=[
24+
{"experimental-lsps-client": None},
25+
{
26+
"experimental-lsps2-service": None,
27+
"experimental-lsps2-promise-secret": "0" * 64,
28+
},
29+
],
2330
)
2431

2532
# We don't need a channel to query for lsps services
@@ -33,11 +40,10 @@ def test_lsps2_enabled(node_factory):
3340
l1, l2 = node_factory.get_nodes(
3441
2,
3542
opts=[
36-
{"dev-lsps-client-enabled": None},
43+
{"experimental-lsps-client": None},
3744
{
38-
"dev-lsps-service-enabled": None,
39-
"dev-lsps2-service-enabled": None,
40-
"dev-lsps2-promise-secret": "0" * 64,
45+
"experimental-lsps2-service": None,
46+
"experimental-lsps2-promise-secret": "0" * 64,
4147
},
4248
],
4349
)
@@ -54,14 +60,13 @@ def test_lsps2_getinfo(node_factory):
5460
l1, l2 = node_factory.get_nodes(
5561
2,
5662
opts=[
57-
{"dev-lsps-client-enabled": None},
63+
{"experimental-lsps-client": None},
5864
{
59-
"dev-lsps-service-enabled": None,
60-
"dev-lsps2-service-enabled": None,
61-
"dev-lsps2-promise-secret": "0" * 64,
65+
"experimental-lsps2-service": None,
66+
"experimental-lsps2-promise-secret": "0" * 64,
6267
"plugin": plugin,
6368
},
64-
],
69+
]
6570
)
6671

6772
node_factory.join_nodes([l1, l2], fundchannel=False)
@@ -77,14 +82,13 @@ def test_lsps2_buy(node_factory):
7782
l1, l2 = node_factory.get_nodes(
7883
2,
7984
opts=[
80-
{"dev-lsps-client-enabled": None},
85+
{"experimental-lsps-client": None},
8186
{
82-
"dev-lsps-service-enabled": None,
83-
"dev-lsps2-service-enabled": None,
84-
"dev-lsps2-promise-secret": "0" * 64,
87+
"experimental-lsps2-service": None,
88+
"experimental-lsps2-promise-secret": "0" * 64,
8589
"plugin": plugin,
8690
},
87-
],
91+
]
8892
)
8993

9094
# We don't need a channel to query for lsps services
@@ -120,11 +124,10 @@ def test_lsps2_buyjitchannel_no_mpp_var_invoice(node_factory, bitcoind):
120124
l1, l2, l3 = node_factory.get_nodes(
121125
3,
122126
opts=[
123-
{"dev-lsps-client-enabled": None},
127+
{"experimental-lsps-client": None},
124128
{
125-
"dev-lsps-service-enabled": None,
126-
"dev-lsps2-service-enabled": None,
127-
"dev-lsps2-promise-secret": "00" * 32,
129+
"experimental-lsps2-service": None,
130+
"experimental-lsps2-promise-secret": "0" * 64,
128131
"plugin": plugin,
129132
"fee-base": 0, # We are going to deduct our fee anyways,
130133
"fee-per-satoshi": 0, # We are going to deduct our fee anyways,
@@ -145,7 +148,7 @@ def test_lsps2_buyjitchannel_no_mpp_var_invoice(node_factory, bitcoind):
145148
"short_channel_id"
146149
]
147150

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

0 commit comments

Comments
 (0)