Skip to content

Commit

Permalink
lightningd: don't ignore fee limits on mutual close.
Browse files Browse the repository at this point in the history
LDK will pick the *upper* limit (see: lightningdevkit/rust-lightning#3014)!

It should not do this, but since you can set a manual range for mutual close, it's probably better to disable this option for close, as it's even more dangerous than documented.

Changelog-Changed: config/JSON: --ignore-fee-limits / setchannel ignorefeelimits no longer applies to mutual close.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Fixes: ElementsProject#7242
  • Loading branch information
rustyrussell authored and endothermicdev committed May 22, 2024
1 parent 9556fa5 commit 877df5a
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 7 deletions.
3 changes: 0 additions & 3 deletions lightningd/closing_control.c
Original file line number Diff line number Diff line change
Expand Up @@ -434,9 +434,6 @@ void peer_start_closingd(struct channel *channel, struct peer_fd *peer_fd)
if (channel->closing_feerate_range) {
min_feerate = channel->closing_feerate_range[0];
max_feerate = channel->closing_feerate_range[1];
} else if (channel->ignore_fee_limits || ld->config.ignore_fee_limits) {
min_feerate = 253;
max_feerate = 0xFFFFFFFF;
}

/* BOLT #3:
Expand Down
1 change: 0 additions & 1 deletion tests/test_closing.py
Original file line number Diff line number Diff line change
Expand Up @@ -4044,7 +4044,6 @@ def test_closing_no_anysegwit_retry(node_factory, bitcoind):
l1.rpc.close(l2.info['id'], destination=oldaddr)


@pytest.mark.xfail(strict=True)
def test_closing_ignore_fee_limits(node_factory, bitcoind, executor):
"""Don't use ignore-fee-limits on mutual close: LDK takes us to the cleaners if we do!"""
l1, l2 = node_factory.line_graph(2, opts=[{'may_reconnect': True,
Expand Down
6 changes: 3 additions & 3 deletions tests/test_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -2491,12 +2491,13 @@ def test_fee_limits(node_factory, bitcoind):
wait_for(lambda: only_one(l2.rpc.listpeerchannels()['channels'])['feerate']['perkw'] == fee)
assert only_one(l2.rpc.listpeerchannels()['channels'])['peer_connected'] is True

l1.rpc.close(l2.info['id'])
# This will fail to mutual close, since l2 won't ignore insane *close* fees!
assert l1.rpc.close(l2.info['id'], unilateraltimeout=5)['type'] == 'unilateral'

# Make sure the resolution of this one doesn't interfere with the next!
# Note: may succeed, may fail with insufficient fee, depending on how
# bitcoind feels!
l2.daemon.wait_for_log('sendrawtx exit')
l1.daemon.wait_for_log('sendrawtx exit')
bitcoind.generate_block(1)
sync_blockheight(bitcoind, [l1, l2])

Expand Down Expand Up @@ -2530,7 +2531,6 @@ def test_fee_limits(node_factory, bitcoind):
# 15sat/byte fee
l1.daemon.wait_for_log('peer_out WIRE_REVOKE_AND_ACK')

# This should wait for close to complete
l1.rpc.close(chan)


Expand Down

0 comments on commit 877df5a

Please sign in to comment.