lightning/tests
Rusty Russell f2f7b6e225 pytest: fix flake in test_anchorspend_using_to_remote
With recent changes, particularly using postgres, we can finish the HTLC before
we force close, so the test fails.  Insert an explicit hangup here so we reliably
get the result we expect:

```
    @pytest.mark.parametrize("anchors", [False, True])
    @unittest.skipIf(TEST_NETWORK != 'regtest', 'elementsd anchors not supportd')
    def test_anchorspend_using_to_remote(node_factory, bitcoind, anchors):
        """Make sure we can use `to_remote` output of previous close to spend anchor"""
        # Try with old output from both anchor and non-anchor channel.
        l4_opts = {}
        if anchors is False:
            l4_opts['dev-force-features'] = "-23"
    
        l1, l2, l3, l4 = node_factory.get_nodes(4, opts=[{},
                                                         {},
                                                         {'disconnect': ['-WIRE_UPDATE_FULFILL_HTLC']},
                                                         l4_opts])
    
        # Give l2 some funds, from a to-remote output.  It will have to spend
        # this to use anchor.
        node_factory.join_nodes([l4, l2])
    
        # l4 unilaterally closes, l2 gets to-remote with its output.
        l4.rpc.pay(l2.rpc.invoice(100000000, 'test', 'test')['bolt11'])
>       wait_for(lambda: only_one(l4.rpc.listpeerchannels()['channels'])['htlcs'] != [])

tests/test_closing.py:4183: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

success = <function test_anchorspend_using_to_remote.<locals>.<lambda> at 0x7f8293e7fe20>
timeout = 180

    def wait_for(success, timeout=TIMEOUT):
        start_time = time.time()
        interval = 0.25
        while not success():
            time_left = start_time + timeout - time.time()
            if time_left <= 0:
>               raise ValueError("Timeout while waiting for {}".format(success))
E               ValueError: Timeout while waiting for <function test_anchorspend_using_to_remote.<locals>.<lambda> at 0x7f8293e7fe20>

```

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2025-06-13 13:55:31 -05:00
..
data python: raise minimum supported python version to 3.9 2025-06-12 13:51:18 +02:00
fuzz splice: Update to Eclair style of reestablish 2025-05-13 14:52:15 +09:30
plugins channeld: remove never-used "reestablish_only" option. 2025-04-29 13:31:23 +09:30
vectors pytest: Remove onion test vectors containing legacy onions. 2022-03-18 09:20:11 +10:30
autogenerate-rpc-examples.py add signmessagewithkey RPC 2025-05-13 13:19:03 +09:30
benchmark.py pytest: always provide payment_secret when making payments. 2021-07-14 14:38:00 -05:00
conftest.py pytest: use --developer instead of environment variable. 2023-09-21 20:08:24 +09:30
fixtures.py pytest: don't add bookeeper-db option if bookkeeper is disabled. 2025-02-24 19:38:37 +10:30
rkls_github_canned_server.py pytest: add blackbox tests for reckless 2023-04-09 12:41:11 +09:30
test_askrene.py askrene: fixed routing in high capacity channels 2025-05-13 19:16:51 +09:30
test_bookkeeper.py bitcoin: make input witness weight calculation explicit. 2025-05-06 12:27:53 +09:30
test_cln_lsps.py lsps: Add test for Lsps0 2025-05-02 13:34:21 -07:00
test_cln_rs.py lightningd: enable peer storage by default, 2025-05-16 23:39:35 +09:30
test_clnrest.py pytest: add override options to prepare for default removal of rest-port/rest-host options. 2025-02-13 21:15:45 -06:00
test_closing.py pytest: fix flake in test_anchorspend_using_to_remote 2025-06-13 13:55:31 -05:00
test_connection.py pytest: fix races now connecting is slightly slower. 2025-05-17 13:05:04 -05:00
test_db.py wallet: fix incorrect channel_htlcs id migration. 2025-05-17 13:05:04 -05:00
test_gossip.py pytest: fix flake in test_gossip_force_broadcast_channel_msgs caused by ping timeout. 2025-05-16 22:40:45 +09:30
test_invoices.py lightningd: improve wait API by making details fields per-subsystem. 2025-04-29 09:38:20 +09:30
test_misc.py lightningd: enable peer storage by default, 2025-05-16 23:39:35 +09:30
test_mkfunding.py pytest: add tests for devtools/mkfunding 2023-01-09 14:50:30 -06:00
test_onion.py lightningd: remove support for legacy onion format. 2022-03-18 09:20:11 +10:30
test_opening.py pytest: make test_v2_rbf_liquidity_ad more robust against other datastore users. 2025-05-16 23:39:35 +09:30
test_pay.py pytest: search for less escaped log messages 2025-05-14 17:12:47 +09:30
test_plugin.py lightningd: enable peer storage by default, 2025-05-16 23:39:35 +09:30
test_reckless.py pytest: test reckless direct install 2025-05-14 13:02:03 +09:30
test_renepay.py pytest: fix race in test_renepay where we didn't wait for all channels. 2025-04-16 08:02:14 +09:30
test_restart.py splice: tx_abort no longer reestablishes 2024-11-21 14:15:36 +10:30
test_runes.py pytest: stop using deprecated commando_rune commands. 2025-02-13 21:15:45 -06:00
test_splice.py bkpr: add bookkeeping assertions to splice in + out tests 2024-11-17 14:25:29 +10:30
test_splicing_disconnect.py pytest: fix test_splice_disconnect_commit 2025-01-27 11:07:04 +10:30
test_splicing_insane.py splice: Allow splice_update to return signatures 2024-11-12 06:42:52 +10:30
test_splicing.py splice: Wait for mempool in tests 2025-05-13 14:52:15 +09:30
test_wallet.py pytest: fix flake in test_peer_anchor_push 2025-05-15 17:20:07 +09:30
test_xpay.py pytest: search for less escaped log messages 2025-05-14 17:12:47 +09:30
utils.py lightningd: enable peer storage by default, 2025-05-16 23:39:35 +09:30
valgrind-suppressions.txt pytest: Use valgrind target suppressions instead of skipping tests 2022-03-10 10:21:41 +10:30