Skip to content

Commit 401ff9a

Browse files
committed
chore(tests): Add a sample test for the lsps_server fixture
1 parent d24fe04 commit 401ff9a

1 file changed

Lines changed: 39 additions & 0 deletions

File tree

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

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

0 commit comments

Comments
 (0)