Skip to content

Commit 46690cb

Browse files
committed
pytest: replicate error where we could miss our returned funds on mutual close.
1. Peer has to not support option_shutdown_anysegwit. 2. We have to restart between opening and closing the channel. 3. We won't see the to-us output, since it's p2wpkh not p2tr. This bug was introduced in 24.11. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
1 parent 462e598 commit 46690cb

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

tests/test_closing.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4275,3 +4275,22 @@ def censoring_sendrawtx(r):
42754275
bitcoind.generate_block(1)
42764276
height = bitcoind.rpc.getblockchaininfo()['blocks']
42774277
l1.daemon.wait_for_log(r"Low-priority anchorspend aiming for block {} \(feerate 7500\)".format(height + 12))
4278+
4279+
4280+
@pytest.mark.xfail(strict=True)
4281+
@unittest.skipIf(TEST_NETWORK != 'regtest', "elementsd doesn't use p2tr anyway")
4282+
def test_onchain_close_no_p2tr(node_factory, bitcoind):
4283+
"""Closing with a peer which doesn't support OPT_SHUTDOWN_ANYSEGWIT"""
4284+
l1, l2 = node_factory.line_graph(2, opts=[{'may_reconnect': True},
4285+
{'may_reconnect': True,
4286+
'dev-force-features': "-27"}])
4287+
4288+
assert len(l1.rpc.listfunds()['outputs']) == 1
4289+
4290+
l1.restart()
4291+
l1.rpc.close(l2.info['id'])
4292+
bitcoind.generate_block(1, wait_for_mempool=1)
4293+
sync_blockheight(bitcoind, [l1])
4294+
4295+
# We should see the output.
4296+
assert len(l1.rpc.listfunds()['outputs']) == 2

0 commit comments

Comments
 (0)