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

Function test_close_feerate_range

tests/test_closing.py:4013–4048  ·  view source on GitHub ↗

Test the quick-close fee range negotiation

(node_factory, bitcoind, chainparams)

Source from the content-addressed store, hash-verified

4011
4012
4013def test_close_feerate_range(node_factory, bitcoind, chainparams):
4014 """Test the quick-close fee range negotiation"""
4015 l1, l2 = node_factory.line_graph(2)
4016
4017 notifications = []
4018
4019 def save_notifications(message, progress, request, **kwargs):
4020 notifications.append(message)
4021
4022 # Lowball the range here.
4023 with l1.rpc.notify(save_notifications):
4024 l1.rpc.close(l2.info['id'], feerange=['253perkw', 'normal'])
4025
4026 if not chainparams['elements']:
4027 l1_range = [151, 4500]
4028 l2_range = [1125, 1000000]
4029 else:
4030 # That fee output is a little chunky.
4031 l1_range = [221, 6577]
4032 l2_range = [1644, 1000000]
4033
4034 l1.daemon.wait_for_log('Negotiating closing fee between {}sat and {}sat satoshi'.format(l1_range[0], l1_range[1]))
4035 l2.daemon.wait_for_log('Negotiating closing fee between {}sat and {}sat satoshi'.format(l2_range[0], l2_range[1]))
4036
4037 overlap = [max(l1_range[0], l2_range[0]), min(l1_range[1], l2_range[1])]
4038 l1.daemon.wait_for_log('performing quickclose in range {}sat-{}sat'.format(overlap[0], overlap[1]))
4039
4040 log = l1.daemon.is_in_log('Their actual closing tx fee is .*sat')
4041 rate = re.match('.*Their actual closing tx fee is ([0-9]*sat).*', log).group(1)
4042
4043 assert notifications == ['Sending closing fee offer {}, with range {}sat-{}sat'.format(rate,
4044 l1_range[0],
4045 l1_range[1]),
4046 'Received closing fee offer {}, with range {}sat-{}sat'.format(rate,
4047 l2_range[0],
4048 l2_range[1])]
4049
4050
4051def test_close_twice(node_factory, executor):

Callers

nothing calls this directly

Calls 5

line_graphMethod · 0.80
wait_for_logMethod · 0.80
is_in_logMethod · 0.80
notifyMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected