mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-02-22 06:41:44 +01:00
pytest: add test for closing feerate greater than final commit tx.
This is now allowed for anchors (as per https://github.com/lightningnetwork/lightning-rfc/pull/847). We need to play with feerates, since we don't put a discount on anchor commitments yet. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
1752616386
commit
e12f9f0872
1 changed files with 37 additions and 0 deletions
|
@ -3132,6 +3132,43 @@ def test_shutdown_alternate_txid(node_factory, bitcoind):
|
|||
wait_for(lambda: l1.rpc.listpeers()['peers'] == [])
|
||||
|
||||
|
||||
@unittest.skipIf(not EXPERIMENTAL_FEATURES, "Needs anchor_outputs")
|
||||
@pytest.mark.developer("needs to set dev-disconnect")
|
||||
def test_closing_higherfee(node_factory, bitcoind, executor):
|
||||
"""With anchor outputs we can ask for a *higher* fee than the last commit tx"""
|
||||
|
||||
# We change the feerate before it starts negotiating close, so it aims
|
||||
# for *higher* than last commit tx.
|
||||
l1, l2 = node_factory.line_graph(2, opts=[{'may_reconnect': True,
|
||||
'dev-no-reconnect': None,
|
||||
'feerates': (7500, 7500, 7500, 7500),
|
||||
'disconnect': ['-WIRE_CLOSING_SIGNED']},
|
||||
{'may_reconnect': True,
|
||||
'dev-no-reconnect': None,
|
||||
'feerates': (7500, 7500, 7500, 7500)}])
|
||||
# This will trigger disconnect.
|
||||
fut = executor.submit(l1.rpc.close, l2.info['id'])
|
||||
l1.daemon.wait_for_log('dev_disconnect')
|
||||
|
||||
# Now adjust fees so l1 asks for more on reconnect.
|
||||
l1.set_feerates((30000,) * 4, False)
|
||||
l2.set_feerates((30000,) * 4, False)
|
||||
l1.restart()
|
||||
l2.restart()
|
||||
l1.rpc.connect(l2.info['id'], 'localhost', l2.port)
|
||||
|
||||
# This causes us to *exceed* previous requirements!
|
||||
l1.daemon.wait_for_log(r'deriving max fee from rate 30000 -> 16440sat \(not 1000000sat\)')
|
||||
|
||||
# This will fail because l1 restarted!
|
||||
with pytest.raises(RpcError, match=r'Connection to RPC server lost.'):
|
||||
fut.result(TIMEOUT)
|
||||
|
||||
# But we still complete negotiation!
|
||||
wait_for(lambda: only_one(l1.rpc.listpeers()['peers'])['channels'][0]['state'] == 'CLOSINGD_COMPLETE')
|
||||
wait_for(lambda: only_one(l2.rpc.listpeers()['peers'])['channels'][0]['state'] == 'CLOSINGD_COMPLETE')
|
||||
|
||||
|
||||
@pytest.mark.developer("needs dev_disconnect")
|
||||
def test_htlc_rexmit_while_closing(node_factory, executor):
|
||||
"""Retranmitting an HTLC revocation while shutting down should work"""
|
||||
|
|
Loading…
Add table
Reference in a new issue