|
6 | 6 | from utils import (
|
7 | 7 | only_one, sync_blockheight, wait_for, TIMEOUT,
|
8 | 8 | account_balance, first_channel_id, closing_fee, TEST_NETWORK,
|
9 |
| - scriptpubkey_addr |
| 9 | + scriptpubkey_addr, EXPERIMENTAL_FEATURES |
10 | 10 | )
|
11 | 11 |
|
12 | 12 | import os
|
@@ -2742,6 +2742,43 @@ def test_shutdown_alternate_txid(node_factory, bitcoind):
|
2742 | 2742 | wait_for(lambda: l1.rpc.listpeers()['peers'] == [])
|
2743 | 2743 |
|
2744 | 2744 |
|
| 2745 | +@unittest.skipIf(not EXPERIMENTAL_FEATURES, "Needs anchor_outputs") |
| 2746 | +@pytest.mark.developer("needs to set dev-disconnect") |
| 2747 | +def test_closing_higherfee(node_factory, bitcoind, executor): |
| 2748 | + """With anchor outputs we can ask for a *higher* fee than the last commit tx""" |
| 2749 | + |
| 2750 | + # We change the feerate before it starts negotiating close, so it aims |
| 2751 | + # for *higher* than last commit tx. |
| 2752 | + l1, l2 = node_factory.line_graph(2, opts=[{'may_reconnect': True, |
| 2753 | + 'dev-no-reconnect': None, |
| 2754 | + 'feerates': (7500, 7500, 7500, 7500), |
| 2755 | + 'disconnect': ['-WIRE_CLOSING_SIGNED']}, |
| 2756 | + {'may_reconnect': True, |
| 2757 | + 'dev-no-reconnect': None, |
| 2758 | + 'feerates': (7500, 7500, 7500, 7500)}]) |
| 2759 | + # This will trigger disconnect. |
| 2760 | + fut = executor.submit(l1.rpc.close, l2.info['id']) |
| 2761 | + l1.daemon.wait_for_log('dev_disconnect') |
| 2762 | + |
| 2763 | + # Now adjust fees so l1 asks for more on reconnect. |
| 2764 | + l1.set_feerates((30000,) * 4, False) |
| 2765 | + l2.set_feerates((30000,) * 4, False) |
| 2766 | + l1.restart() |
| 2767 | + l2.restart() |
| 2768 | + l1.rpc.connect(l2.info['id'], 'localhost', l2.port) |
| 2769 | + |
| 2770 | + # This causes us to *exceed* previous requirements! |
| 2771 | + l1.daemon.wait_for_log(r'deriving max fee from rate 30000 -> 16440sat \(not 8430sat\)') |
| 2772 | + |
| 2773 | + # This will fail because l1 restarted! |
| 2774 | + with pytest.raises(RpcError, match=r'Connection to RPC server lost.'): |
| 2775 | + fut.result(TIMEOUT) |
| 2776 | + |
| 2777 | + # But we still complete negotiation! |
| 2778 | + wait_for(lambda: only_one(l1.rpc.listpeers()['peers'])['channels'][0]['state'] == 'CLOSINGD_COMPLETE') |
| 2779 | + wait_for(lambda: only_one(l2.rpc.listpeers()['peers'])['channels'][0]['state'] == 'CLOSINGD_COMPLETE') |
| 2780 | + |
| 2781 | + |
2745 | 2782 | @pytest.mark.developer("needs dev_disconnect")
|
2746 | 2783 | def test_htlc_rexmit_while_closing(node_factory, executor):
|
2747 | 2784 | """Retranmitting an HTLC revocation while shutting down should work"""
|
|
0 commit comments