What changed, and why it matters
This commit only adds a new test for an existing feature and a small Python helper to call that feature. There is no change to the actual Core Lightning server code that handles money or network messages, so it does not create or fix a security issue.
No security action needed. Treat as normal test/development commit.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff adds a splicein() wrapper in contrib/pyln-client/pyln/client/lightning.py and a new pytest test_easy_splice_in in tests/test_splice.py. The wrapper merely builds a JSON-RPC payload and calls the pre-existing splicein RPC method. The test exercises the splice-in flow on regtest and is marked @pytest.mark.xfail(strict=True), meaning it is expected to fail until the feature is fully working. No C/lightningd daemon code is modified.
Changed components
contrib/pyln-client/pyln/client/lightning.pytests/test_splice.pyInspect captured patch +48 / −0
diff --git a/contrib/pyln-client/pyln/client/lightning.py b/contrib/pyln-client/pyln/client/lightning.py
index 2d876556..fe4189c1 100644
--- a/contrib/pyln-client/pyln/client/lightning.py
+++ b/contrib/pyln-client/pyln/client/lightning.py
@@ -1228,6 +1228,14 @@ class LightningRpc(UnixDomainSocketRpc):
}
return self.call("dev-splice", payload)
+ def splicein(self, channel, amount):
+ """ Execute a splice """
+ payload = {
+ "channel": channel,
+ "amount": amount,
+ }
+ return self.call("splicein", payload)
+
def stfu_channels(self, channel_ids):
""" STFU multiple channels """
payload = {
diff --git a/tests/test_splice.py b/tests/test_splice.py
index 8ae072f9..18e1393f 100644
--- a/tests/test_splice.py
+++ b/tests/test_splice.py
@@ -308,6 +308,46 @@ def test_script_two_chan_splice_inout(node_factory, bitcoind):
l2.rpc.pay(inv['bolt11'])
+@pytest.mark.xfail(strict=True)
+@pytest.mark.openchannel('v1')
+@pytest.mark.openchannel('v2')
+@unittest.skipIf(TEST_NETWORK != 'regtest', 'elementsd doesnt yet support PSBT features we need')
+def test_easy_splice_in(node_factory, bitcoind, chainparams):
+ fundamt = 1000000
+
+ coin_mvt_plugin = Path(__file__).parent / "plugins" / "coin_movements.py"
+ l1, l2 = node_factory.line_graph(2, fundamount=fundamt, wait_for_announce=True,
+ opts={'experimental-splicing': None,
+ 'plugin': coin_mvt_plugin})
+
+ # Splice in 100k sats into first channel
+ spliceamt = 100000
+
+ l1.rpc.splicein("*:?", f"{spliceamt}")
+ p1 = only_one(l1.rpc.listpeerchannels(peer_id=l2.info['id'])['channels'])
+ p2 = only_one(l2.rpc.listpeerchannels(l1.info['id'])['channels'])
+ assert p1['inflight'][0]['splice_amount'] == spliceamt
+ assert p1['inflight'][0]['total_funding_msat'] == (fundamt + spliceamt) * 1000
+ assert p1['inflight'][0]['our_funding_msat'] == fundamt * 1000
+ assert p2['inflight'][0]['splice_amount'] == 0
+ assert p2['inflight'][0]['total_funding_msat'] == (fundamt + spliceamt) * 1000
+ assert p2['inflight'][0]['our_funding_msat'] == 0
+ bitcoind.generate_block(6, wait_for_mempool=1)
+ l2.daemon.wait_for_log(r'lightningd, splice_locked clearing inflights')
+
+ p1 = only_one(l1.rpc.listpeerchannels(peer_id=l2.info['id'])['channels'])
+ p2 = only_one(l2.rpc.listpeerchannels(l1.info['id'])['channels'])
+ assert p1['to_us_msat'] == (fundamt + spliceamt) * 1000
+ assert p1['total_msat'] == (fundamt + spliceamt) * 1000
+ assert p2['to_us_msat'] == 0
+ assert p2['total_msat'] == (fundamt + spliceamt) * 1000
+ assert 'inflight' not in p1
+ assert 'inflight' not in p2
+
+ wait_for(lambda: len(l1.rpc.listfunds()['outputs']) == 1)
+ wait_for(lambda: len(l1.rpc.listfunds()['channels']) == 1)
+
+
# Makes channels going from node 1 -> 2, 2 -> 3, etc up to 'qty' number channels.
# If balanced is True, than each channel will be balanced -- otherwise the lower
# index channel will have funds in the channel to the higher indexed one.
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.