Skip to content

Commit c99c0e1

Browse files
committed
chore(tests): Add a sample test for the lsps_server fixture
1 parent e468fec commit c99c0e1

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

libs/gl-client-py/tests/test_plugin.py

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,3 +201,42 @@ def test_trampoline_multi_htlc(bitcoind, clients, node_factory):
201201
res = n1.trampoline_pay(inv["bolt11"], bytes.fromhex(l2.info["id"]))
202202
assert res
203203
assert res.parts == 2
204+
205+
206+
def test_lsps_plugin_calls(
207+
clients, bitcoind: BitcoinD, node_factory: NodeFactory, lsps_server
208+
):
209+
"""Test that we can call the `lsps-jitchannel` method from a
210+
variety of places.
211+
212+
```ditaa
213+
S --- LSP --- R1
214+
```
215+
216+
"""
217+
# Bootstrap a very simple network
218+
lsp_id = lsps_server.info["id"]
219+
(r1,) = node_factory.get_nodes(1, opts=[{"disable-plugin": "cln-grpc"}])
220+
221+
# Get the GL node
222+
c = clients.new()
223+
c.register()
224+
s = c1.node()
225+
s.connect(lsps_server)
226+
227+
res = s.localrpc.lsps_lsps2_invoice(
228+
lsp_id=lsp_id,
229+
token=None,
230+
amount_msat="1337msat",
231+
description="description",
232+
label="lbl1",
233+
)
234+
235+
inv = s.localrpc.decodepay(res['bolt11'])
236+
pprint(inv)
237+
238+
# Only one routehint, with only one hop, the LSP to the destination
239+
assert len(inv['routes']) == 1 and len(inv['routes'][0]) == 1
240+
assert inv['description'] == 'description'
241+
rh = inv['routes'][0][0]
242+
assert rh['pubkey'] == lsp_id

0 commit comments

Comments
 (0)