diff --git a/contrib/pyln-client/pyln/client/lightning.py b/contrib/pyln-client/pyln/client/lightning.py index 70c1d0f279f3..f1ab4dd74116 100644 --- a/contrib/pyln-client/pyln/client/lightning.py +++ b/contrib/pyln-client/pyln/client/lightning.py @@ -1321,7 +1321,7 @@ def sendonion( } return self.call("sendonion", payload) - def setchannel(self, id, feebase=None, feeppm=None, htlcmin=None, htlcmax=None, enforcedelay=None): + def setchannel(self, id, feebase=None, feeppm=None, htlcmin=None, htlcmax=None, enforcedelay=None, ignorefeelimits=None): """Set configuration a channel/peer {id} (or 'all'). {feebase} is a value in millisatoshi that is added as base fee @@ -1339,6 +1339,8 @@ def setchannel(self, id, feebase=None, feeppm=None, htlcmin=None, htlcmax=None, {enforcedelay} is the number of seconds before enforcing this change. + {ignorefeelimits} is a flag to indicate peer can set any feerate (dangerous!) + """ payload = { "id": id, @@ -1347,6 +1349,7 @@ def setchannel(self, id, feebase=None, feeppm=None, htlcmin=None, htlcmax=None, "htlcmin": htlcmin, "htlcmax": htlcmax, "enforcedelay": enforcedelay, + "ignorefeelimits": ignorefeelimits, } return self.call("setchannel", payload) diff --git a/tests/test_connection.py b/tests/test_connection.py index 0230a45b7cff..04a9c0681f7d 100644 --- a/tests/test_connection.py +++ b/tests/test_connection.py @@ -2500,6 +2500,8 @@ def test_fee_limits(node_factory, bitcoind): # Kick off fee adjustment using HTLC. l1.pay(l2, 1000) + assert 'ignore_fee_limits' not in only_one(l2.rpc.listpeerchannels()['channels']) + assert 'ignore_fee_limits' not in only_one(l1.rpc.listpeerchannels()['channels']) # L1 asks for stupid low fee (will actually hit the floor of 253) l1.stop() @@ -2512,10 +2514,14 @@ def test_fee_limits(node_factory, bitcoind): assert 'update_fee 253 outside range 1875-75000' in only_one(l1.rpc.listpeerchannels(l2.info['id'])['channels'])['status'][0] assert 'update_fee 253 outside range 1875-75000' in only_one(l2.rpc.listpeerchannels(l1.info['id'])['channels'])['status'][0] + assert only_one(l2.rpc.listpeerchannels()['channels'])['feerate']['perkw'] != 253 # Make l2 accept those fees, and it should recover. - l2.stop() - l2.set_feerates((15, 15, 15, 15), False) - l2.start() + assert only_one(l2.rpc.setchannel(l1.get_channel_scid(l2), ignorefeelimits=True)['channels'])['ignore_fee_limits'] is True + assert only_one(l2.rpc.listpeerchannels()['channels'])['ignore_fee_limits'] is True + + # Now we stay happy (and connected!) + wait_for(lambda: only_one(l2.rpc.listpeerchannels()['channels'])['feerate']['perkw'] == 253) + assert only_one(l2.rpc.listpeerchannels()['channels'])['peer_connected'] is True l1.rpc.close(l2.info['id']) diff --git a/tests/test_pay.py b/tests/test_pay.py index 3f7f8bc65724..15e699363e14 100644 --- a/tests/test_pay.py +++ b/tests/test_pay.py @@ -1994,6 +1994,7 @@ def channel_get_config(scid): assert(result['channels'][0]['fee_proportional_millionths'] == 137) assert(result['channels'][0]['minimum_htlc_out_msat'] == 17) assert(result['channels'][0]['maximum_htlc_out_msat'] == 133337) + assert(result['channels'][0]['ignore_fee_limits'] is False) # check if custom values made it into the database db_fees = channel_get_config(scid)