pytest: test that we refuse incoming open requests if we have no feerates.
What changed, and why it matters
This commit only adds a new automated test to Core Lightning. The test checks that the node refuses incoming channel-opening requests when it cannot estimate Bitcoin transaction fees. It does not change any production code, so by itself it cannot introduce or fix a security issue. It may be a regression test for behavior fixed in an earlier commit.
No action required for this commit alone. If reviewing a series, verify whether a preceding or following commit implements the production-code change that makes this xfail test pass. Treat the actual security relevance as dependent on that related code change.
Security signals we found
Test-only change: no daemon or protocol code modified
xfail marker indicates the tested behavior is not yet implemented or the test is documenting known behavior
Topic relates to fee-estimation failure handling during channel open
Evidence from the diff
The diff adds a single pytest test, test_opening_incoming_unknown_feerates, in tests/test_opening.py. The test configures a node with no fee estimates (feerates=None, dev-no-fake-fees=True, ignore-fee-limits=True), then attempts to open a channel to it and expects an RpcError containing ‘Cannot accept channel: feerates unknown’. The test is marked xfail(strict=True), meaning it is currently expected to fail and the test suite will fail if it unexpectedly passes. No C/lightningd source code is modified.
Changed components
tests/test_opening.pyInspect captured patch +26 / −0
diff --git a/tests/test_opening.py b/tests/test_opening.py
index 13863df4..39ae47e1 100644
--- a/tests/test_opening.py
+++ b/tests/test_opening.py
@@ -2929,6 +2929,32 @@ def test_zeroconf_withhold(node_factory, bitcoind, stay_withheld, mutual_close):
wait_for(lambda: only_one(l1.rpc.listpeerchannels()['channels'])['state'] == 'AWAITING_UNILATERAL')
+@pytest.mark.openchannel('v1')
+@pytest.mark.openchannel('v2')
+@pytest.mark.xfail(strict=True)
+def test_opening_incoming_unknown_feerates(node_factory, bitcoind):
+ """
+ Don't allow incoming channels if we can't estimate feerates.
+ """
+ nofee_opts = {'ignore-fee-limits': True,
+ 'feerates': None,
+ 'dev-no-fake-fees': True}
+
+ l1, l2 = node_factory.get_nodes(2, opts=[{}, nofee_opts])
+
+ l1.fundwallet(FUNDAMOUNT)
+
+ # Connect peers
+ l1.rpc.connect(l2.info['id'], 'localhost', l2.port)
+
+ # Verify fee estimation is failing
+ l2.daemon.wait_for_log('Unable to estimate any fees')
+
+ # Open channel l1 <-> l2: l2 should refuse!
+ with pytest.raises(RpcError, match=r'They sent.*Cannot accept channel: feerates unknown'):
+ l1.rpc.fundchannel(l2.info['id'], 100000)
+
+
def test_zeroconf_withhold_htlc_failback(node_factory, bitcoind):
"""Test that CLTV timeout on a withheld channel fails HTLCs back upstream without force-close."""
zeroconf_plugin = str(Path(__file__).parent / "plugins" / "zeroconf-selective.py")
Why this scored 11/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.