Files
palladum-lightning/tests/test_cln_lsps.py
Peter Neuroth 581eb3076f lsp_plugin: add lsps2_getinfo handler and call
This commit adds the lsps2_get_info call defined by BLIP052. It also
adds a test policy plugin that the LSP service plugin uses to fetch the
actual fee menu from to separate the concerns of providing a spec
compliant implementation of an LSP and making business decisions about
fee prices.

Signed-off-by: Peter Neuroth <pet.v.ne@gmail.com>
2025-11-13 10:58:49 +10:30

67 lines
1.8 KiB
Python

from fixtures import * # noqa: F401,F403
from pyln.testing.utils import RUST
import os
import unittest
RUST_PROFILE = os.environ.get("RUST_PROFILE", "debug")
def test_lsps_service_disabled(node_factory):
"""By default we disable the LSPS service plugin.
It should only be enabled if we explicitly set the config option
`lsps-service=True`.
"""
l1 = node_factory.get_node(1)
l1.daemon.is_in_log("`lsps-service` not enabled")
@unittest.skipUnless(RUST, 'RUST is not enabled')
def test_lsps0_listprotocols(node_factory):
l1, l2 = node_factory.get_nodes(2, opts=[
{"dev-lsps-client-enabled": None}, {"dev-lsps-service-enabled": None}
])
# We don't need a channel to query for lsps services
node_factory.join_nodes([l1, l2], fundchannel=False)
res = l1.rpc.lsps_listprotocols(lsp_id=l2.info['id'])
assert res
def test_lsps2_enabled(node_factory):
l1, l2 = node_factory.get_nodes(2, opts=[
{"dev-lsps-client-enabled": None},
{
"dev-lsps-service-enabled": None,
"dev-lsps2-service-enabled": None,
"dev-lsps2-promise-secret": "0" * 64
}
])
node_factory.join_nodes([l1, l2], fundchannel=False)
res = l1.rpc.lsps_listprotocols(lsp_id=l2.info['id'])
assert res['protocols'] == [2]
def test_lsps2_getinfo(node_factory):
plugin = os.path.join(os.path.dirname(__file__), 'plugins/lsps2_policy.py')
l1, l2 = node_factory.get_nodes(2, opts=[
{"dev-lsps-client-enabled": None},
{
"dev-lsps-service-enabled": None,
"dev-lsps2-service-enabled": None,
"dev-lsps2-promise-secret": "0" * 64,
"plugin": plugin
}
])
node_factory.join_nodes([l1, l2], fundchannel=False)
res = l1.rpc.lsps_lsps2_getinfo(lsp_id=l2.info['id'])
assert res["opening_fee_params_menu"]