mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-02-22 06:41:44 +01:00
pytest: test for setchannel's new ignorefeelimits.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
99a5059132
commit
7372b518ef
3 changed files with 14 additions and 4 deletions
|
@ -1321,7 +1321,7 @@ class LightningRpc(UnixDomainSocketRpc):
|
||||||
}
|
}
|
||||||
return self.call("sendonion", payload)
|
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').
|
"""Set configuration a channel/peer {id} (or 'all').
|
||||||
|
|
||||||
{feebase} is a value in millisatoshi that is added as base fee
|
{feebase} is a value in millisatoshi that is added as base fee
|
||||||
|
@ -1339,6 +1339,8 @@ class LightningRpc(UnixDomainSocketRpc):
|
||||||
{enforcedelay} is the number of seconds before enforcing this
|
{enforcedelay} is the number of seconds before enforcing this
|
||||||
change.
|
change.
|
||||||
|
|
||||||
|
{ignorefeelimits} is a flag to indicate peer can set any feerate (dangerous!)
|
||||||
|
|
||||||
"""
|
"""
|
||||||
payload = {
|
payload = {
|
||||||
"id": id,
|
"id": id,
|
||||||
|
@ -1347,6 +1349,7 @@ class LightningRpc(UnixDomainSocketRpc):
|
||||||
"htlcmin": htlcmin,
|
"htlcmin": htlcmin,
|
||||||
"htlcmax": htlcmax,
|
"htlcmax": htlcmax,
|
||||||
"enforcedelay": enforcedelay,
|
"enforcedelay": enforcedelay,
|
||||||
|
"ignorefeelimits": ignorefeelimits,
|
||||||
}
|
}
|
||||||
return self.call("setchannel", payload)
|
return self.call("setchannel", payload)
|
||||||
|
|
||||||
|
|
|
@ -2500,6 +2500,8 @@ def test_fee_limits(node_factory, bitcoind):
|
||||||
|
|
||||||
# Kick off fee adjustment using HTLC.
|
# Kick off fee adjustment using HTLC.
|
||||||
l1.pay(l2, 1000)
|
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 asks for stupid low fee (will actually hit the floor of 253)
|
||||||
l1.stop()
|
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(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 '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.
|
# Make l2 accept those fees, and it should recover.
|
||||||
l2.stop()
|
assert only_one(l2.rpc.setchannel(l1.get_channel_scid(l2), ignorefeelimits=True)['channels'])['ignore_fee_limits'] is True
|
||||||
l2.set_feerates((15, 15, 15, 15), False)
|
assert only_one(l2.rpc.listpeerchannels()['channels'])['ignore_fee_limits'] is True
|
||||||
l2.start()
|
|
||||||
|
# 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'])
|
l1.rpc.close(l2.info['id'])
|
||||||
|
|
||||||
|
|
|
@ -1994,6 +1994,7 @@ def test_setchannel_usage(node_factory, bitcoind):
|
||||||
assert(result['channels'][0]['fee_proportional_millionths'] == 137)
|
assert(result['channels'][0]['fee_proportional_millionths'] == 137)
|
||||||
assert(result['channels'][0]['minimum_htlc_out_msat'] == 17)
|
assert(result['channels'][0]['minimum_htlc_out_msat'] == 17)
|
||||||
assert(result['channels'][0]['maximum_htlc_out_msat'] == 133337)
|
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
|
# check if custom values made it into the database
|
||||||
db_fees = channel_get_config(scid)
|
db_fees = channel_get_config(scid)
|
||||||
|
|
Loading…
Add table
Reference in a new issue