From 6a03a8ce87a7da59f9ae4174ace4e1066d5c4b7e Mon Sep 17 00:00:00 2001 From: enaples Date: Thu, 9 Apr 2026 17:12:01 +0200 Subject: [PATCH 1/3] pytest: test spliceout exceeds channel balance --- tests/test_splice.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/tests/test_splice.py b/tests/test_splice.py index ffa1bb63a4af..4feeddc77674 100644 --- a/tests/test_splice.py +++ b/tests/test_splice.py @@ -1,6 +1,6 @@ from fixtures import * # noqa: F401,F403 from pathlib import Path -from pyln.client import Millisatoshi +from pyln.client import RpcError, Millisatoshi import pytest import re import unittest @@ -716,3 +716,16 @@ def test_easy_splice_out_into_channel(node_factory, bitcoind, chainparams): end_chan1_balance = Millisatoshi(bkpr_account_balance(l2, chan1)) assert initial_chan1_balance + Millisatoshi(spliceamt * 1000) == end_chan1_balance + + +@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_spliceout_exceeds_channel_balance(node_factory): + l1, l2 = node_factory.line_graph(2, fundamount=1000000, wait_for_announce=True, + opts={'experimental-splicing': None}) + with pytest.raises(RpcError): + l1.rpc.spliceout("*:?", "99999999") # way more than channel holds + p1 = only_one(l1.rpc.listpeerchannels(peer_id=l2.info['id'])['channels']) + assert 'inflight' not in p1 From 349934a0bdfd1dcf500b8dd75dc584b00d8f75cf Mon Sep 17 00:00:00 2001 From: enaples Date: Fri, 10 Apr 2026 10:32:26 +0200 Subject: [PATCH 2/3] pytest: add missing test description --- tests/test_splice.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/test_splice.py b/tests/test_splice.py index 4feeddc77674..dd0b48f89365 100644 --- a/tests/test_splice.py +++ b/tests/test_splice.py @@ -723,6 +723,7 @@ def test_easy_splice_out_into_channel(node_factory, bitcoind, chainparams): @pytest.mark.openchannel('v2') @unittest.skipIf(TEST_NETWORK != 'regtest', 'elementsd doesnt yet support PSBT features we need') def test_spliceout_exceeds_channel_balance(node_factory): + """Test splicing out more than the channel balance fails""" l1, l2 = node_factory.line_graph(2, fundamount=1000000, wait_for_announce=True, opts={'experimental-splicing': None}) with pytest.raises(RpcError): From 63b68719f4051ee55589a9bccc5111e782789380 Mon Sep 17 00:00:00 2001 From: Dusty Daemon Date: Mon, 13 Apr 2026 13:43:45 -0700 Subject: [PATCH 3/3] splicescript: Fix memleak during error Move the abort package allocation onto the command instead of the plugin so it is cleaned up when the command is done. Changelog-None: --- plugins/spender/splice.c | 2 +- tests/test_splice.py | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/plugins/spender/splice.c b/plugins/spender/splice.c index 986380dd6bea..a0ca725d6e1a 100644 --- a/plugins/spender/splice.c +++ b/plugins/spender/splice.c @@ -187,7 +187,7 @@ static struct command_result *do_fail(struct command *cmd, "splice_error(psbt:%p, splice_cmd:%p, str: %s)", splice_cmd->psbt, splice_cmd, str ?: ""); - abort_pkg = tal(cmd->plugin, struct abort_pkg); + abort_pkg = tal(cmd, struct abort_pkg); abort_pkg->splice_cmd = tal_steal(abort_pkg, splice_cmd); abort_pkg->str = tal_strdup(abort_pkg, str); abort_pkg->code = code; diff --git a/tests/test_splice.py b/tests/test_splice.py index dd0b48f89365..019e74c0534c 100644 --- a/tests/test_splice.py +++ b/tests/test_splice.py @@ -718,7 +718,6 @@ def test_easy_splice_out_into_channel(node_factory, bitcoind, chainparams): assert initial_chan1_balance + Millisatoshi(spliceamt * 1000) == end_chan1_balance -@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')