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

Function test_set_feerate_offset

tests/test_misc.py:4976–5009  ·  view source on GitHub ↗
(node_factory, bitcoind)

Source from the content-addressed store, hash-verified

4974
4975
4976def test_set_feerate_offset(node_factory, bitcoind):
4977 opts = [{'commit-feerate-offset': 100}, {}]
4978 l1, l2 = node_factory.get_nodes(2, opts=opts)
4979 assert l1.daemon.is_in_log('Server started with public key')
4980 configs = l1.rpc.listconfigs()['configs']
4981 assert configs['commit-feerate-offset'] == {'source': 'cmdline',
4982 'value_int': 100}
4983 scid12 = l1.fundchannel(l2)[0]
4984 # chanid = l1.get_channel_scid(l2)
4985
4986 # node 1 sets fees.
4987 l1.set_feerates((14000, 11000, 7500, 3750))
4988
4989 l1.pay(l2, 200000000)
4990 # First payment causes fee update, which should reflect the feerate offset.
4991 if 'anchors/even' in only_one(l1.rpc.listpeerchannels()['channels'])['channel_type']['names']:
4992 feerate = 3850
4993 min_feerate = 253
4994 else:
4995 feerate = 11100
4996 min_feerate = 1875
4997 # our_max is what we're willing to pay ourselves (MAX_OUR_FEERATE_PER_KW),
4998 # as opposed to max, which is what we'll tolerate from the peer.
4999 l1.daemon.wait_for_log(f'lightningd: update_feerates: feerate = {feerate}, '
5000 f'min={min_feerate}, max=150000, our_max=100000, '
5001 f'penalty=7500')
5002 l2.daemon.wait_for_log(f'peer updated fee to {feerate}')
5003 l2.pay(l1, 100000000)
5004
5005 # Now shutdown cleanly.
5006 l1.rpc.close(scid12)
5007
5008 l1.daemon.wait_for_log(' to CLOSINGD_COMPLETE')
5009 l2.daemon.wait_for_log(' to CLOSINGD_COMPLETE')
5010
5011
5012def test_low_fd_limit(node_factory, bitcoind):

Callers

nothing calls this directly

Calls 10

only_oneFunction · 0.90
get_nodesMethod · 0.80
is_in_logMethod · 0.80
listconfigsMethod · 0.80
set_feeratesMethod · 0.80
listpeerchannelsMethod · 0.80
wait_for_logMethod · 0.80
fundchannelMethod · 0.45
payMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected