MCPcopy Create free account
hub / github.com/ElementsProject/lightning / test_closing_higherfee

Function test_closing_higherfee

tests/test_closing.py:3814–3851  ·  view source on GitHub ↗

We can ask for a *higher* fee than the last commit tx

(node_factory, bitcoind, executor, anchors)

Source from the content-addressed store, hash-verified

3812
3813@pytest.mark.parametrize("anchors", [False, True])
3814def test_closing_higherfee(node_factory, bitcoind, executor, anchors):
3815 """We can ask for a *higher* fee than the last commit tx"""
3816
3817 opts = {'may_reconnect': True,
3818 'dev-no-reconnect': None,
3819 'feerates': (7500, 7500, 7500, 7500)}
3820 if anchors is False:
3821 opts['dev-force-features'] = "-23"
3822
3823 # We change the feerate before it starts negotiating close, so it aims
3824 # for *higher* than last commit tx.
3825 l1, l2 = node_factory.line_graph(2, opts=[{**opts,
3826 **{'disconnect': ['-WIRE_CLOSING_SIGNED']}},
3827 opts])
3828 # This will trigger disconnect.
3829 fut = executor.submit(l1.rpc.close, l2.info['id'])
3830 l1.daemon.wait_for_log('dev_disconnect')
3831
3832 # Now adjust fees so l1 asks for more on reconnect.
3833 l1.set_feerates((30000,) * 4, False)
3834 l2.set_feerates((30000,) * 4, False)
3835
3836 # Allow l1 to complete next time
3837 l1.disconnect = None
3838 l1.restart()
3839 l2.restart()
3840 l1.rpc.connect(l2.info['id'], 'localhost', l2.port)
3841
3842 # This causes us to *exceed* previous requirements!
3843 l1.daemon.wait_for_log(r'deriving max fee from rate 30000 -> .*sat')
3844
3845 # This will fail because l1 restarted!
3846 with pytest.raises(RpcError, match=r'Connection to RPC server lost.'):
3847 fut.result(TIMEOUT)
3848
3849 # But we still complete negotiation!
3850 wait_for(lambda: l1.rpc.listpeerchannels()['channels'][0]['state'] == 'CLOSINGD_COMPLETE')
3851 wait_for(lambda: l2.rpc.listpeerchannels()['channels'][0]['state'] == 'CLOSINGD_COMPLETE')
3852
3853
3854@pytest.mark.flaky(reruns=3)

Callers

nothing calls this directly

Calls 7

wait_forFunction · 0.90
line_graphMethod · 0.80
wait_for_logMethod · 0.80
set_feeratesMethod · 0.80
restartMethod · 0.80
listpeerchannelsMethod · 0.80
connectMethod · 0.45

Tested by

no test coverage detected