pytest: test for watchtime-blocks=0
What changed, and why it matters
This commit only adds a new test case to the project's test suite. It checks that the software behaves in a known, limited way when a configuration option called 'watchtime-blocks' is set to 0. The test is currently marked as expected to fail ('xfail'), meaning it documents behavior that does not yet work as desired. There is no actual code fix or change to the main software here, and nothing in the commit suggests an active security vulnerability is being patched.
No immediate security action is required. Treat this as a routine test-suite addition. If tracking the underlying behavior, monitor future commits that address the xfail or change HSMD signing logic for watchtime-blocks=0.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff adds a single pytest test, test_zero_locktime_blocks, to tests/test_misc.py. The test creates a three-node line graph with the middle node configured with watchtime-blocks=0, attempts a payment and channel closes, and is decorated with @pytest.mark.xfail(strict=True). The commit message states that watchtime-blocks=0 is legal but not advisable, and that the HSMD (Hardware Security Module daemon) refuses to sign off on operations in this configuration. No production code is modified.
Changed components
tests/test_misc.pyInspect captured patch +15 / −0
diff --git a/tests/test_misc.py b/tests/test_misc.py
index c0f551ce..6f8db4c8 100644
--- a/tests/test_misc.py
+++ b/tests/test_misc.py
@@ -4972,3 +4972,18 @@ def test_tracing(node_factory):
assert res[0]['traceId'] == '00112233445566778899aabbccddeeff'
# Everyone has a parent!
assert 'parentId' in res[0]
+
+
+@pytest.mark.xfail(strict=True)
+def test_zero_locktime_blocks(node_factory, bitcoind):
+ """Ensure our node "works" even if locktime set to 0."""
+ l1, l2, l3 = node_factory.line_graph(3, opts=[{}, {'watchtime-blocks': 0}, {}], wait_for_announce=True)
+
+ # We should be able to use the channel and close it.
+ inv = l3.rpc.invoice(10000, 'test_zero_locktime_blocks', 'test_zero_locktime_blocks')
+ l1.rpc.xpay(inv['bolt11'])
+
+ l1.rpc.close(l2.info['id'])
+ l2.rpc.close(l3.info['id'])
+ bitcoind.generate_block(1, wait_for_mempool=2)
+ sync_blockheight(bitcoind, [l1, l2, l3])
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.