bcli: use a more urgent feerate for HTLCs and penalty transactions

A CONSERVATIVE/3 target for them.

Some noisy changes to the tests as we had to update the estimatesmartfee
mock.

Changelog-Changed: We now use a higher feerate for resolving onchain HTLCs and for penalty transactions
This commit is contained in:
darosior
2020-03-10 19:31:24 +01:00
committed by neil saitug
parent 77e7beeb06
commit 7c0af81c21
6 changed files with 121 additions and 65 deletions

View File

@@ -276,7 +276,7 @@ def test_htlc_sig_persistence(node_factory, bitcoind, executor):
"""
# Feerates identical so we don't get gratuitous commit to update them
l1 = node_factory.get_node(options={'dev-no-reconnect': None},
feerates=(7500, 7500, 7500))
feerates=(7500, 7500, 7500, 7500))
l2 = node_factory.get_node(disconnect=['+WIRE_COMMITMENT_SIGNED'])
l1.rpc.connect(l2.info['id'], 'localhost', l2.port)
@@ -327,7 +327,7 @@ def test_htlc_out_timeout(node_factory, bitcoind, executor):
# Feerates identical so we don't get gratuitous commit to update them
l1 = node_factory.get_node(disconnect=disconnects,
options={'dev-no-reconnect': None},
feerates=(7500, 7500, 7500))
feerates=(7500, 7500, 7500, 7500))
l2 = node_factory.get_node()
l1.rpc.connect(l2.info['id'], 'localhost', l2.port)
@@ -394,7 +394,7 @@ def test_htlc_in_timeout(node_factory, bitcoind, executor):
# Feerates identical so we don't get gratuitous commit to update them
l1 = node_factory.get_node(disconnect=disconnects,
options={'dev-no-reconnect': None},
feerates=(7500, 7500, 7500))
feerates=(7500, 7500, 7500, 7500))
l2 = node_factory.get_node()
l1.rpc.connect(l2.info['id'], 'localhost', l2.port)
@@ -1281,11 +1281,11 @@ def test_htlc_send_timeout(node_factory, bitcoind):
"""Test that we don't commit an HTLC to an unreachable node."""
# Feerates identical so we don't get gratuitous commit to update them
l1 = node_factory.get_node(options={'log-level': 'io'},
feerates=(7500, 7500, 7500))
feerates=(7500, 7500, 7500, 7500))
# Blackhole it after it sends HTLC_ADD to l3.
l2 = node_factory.get_node(disconnect=['0WIRE_UPDATE_ADD_HTLC'],
options={'log-level': 'io'},
feerates=(7500, 7500, 7500))
feerates=(7500, 7500, 7500, 7500))
l3 = node_factory.get_node()
l1.rpc.connect(l2.info['id'], 'localhost', l2.port)
@@ -1385,7 +1385,7 @@ def test_feerates(node_factory):
# Now try setting them, one at a time.
# Set CONSERVATIVE/2 feerate, for max and unilateral_close
l1.set_feerates((15000, 0, 0), True)
l1.set_feerates((15000, 0, 0, 0), True)
wait_for(lambda: len(l1.rpc.feerates('perkw')['perkw']) == 3)
feerates = l1.rpc.feerates('perkw')
assert feerates['perkw']['unilateral_close'] == 15000
@@ -1394,13 +1394,27 @@ def test_feerates(node_factory):
assert feerates['perkw']['max_acceptable'] == 15000 * 10
assert feerates['perkw']['min_acceptable'] == 253
# Set CONSERVATIVE/3 feerate, for htlc_resolution and penalty
l1.set_feerates((15000, 11000, 0, 0), True)
wait_for(lambda: len(l1.rpc.feerates('perkw')['perkw']) == 5)
feerates = l1.rpc.feerates('perkw')
assert feerates['perkw']['unilateral_close'] == 15000
assert feerates['perkw']['htlc_resolution'] == 11000
assert feerates['perkw']['penalty'] == 11000
assert feerates['warning'] == 'Some fee estimates unavailable: bitcoind startup?'
assert 'perkb' not in feerates
assert feerates['perkw']['max_acceptable'] == 15000 * 10
assert feerates['perkw']['min_acceptable'] == 253
# Set ECONOMICAL/4 feerate, for all but min
l1.set_feerates((15000, 6250, 0), True)
l1.set_feerates((15000, 11000, 6250, 0), True)
wait_for(lambda: len(l1.rpc.feerates('perkb')['perkb']) == len(types) + 2)
feerates = l1.rpc.feerates('perkb')
assert feerates['perkb']['unilateral_close'] == 15000 * 4
assert feerates['perkb']['htlc_resolution'] == 11000 * 4
assert feerates['perkb']['penalty'] == 11000 * 4
for t in types:
if t != "unilateral_close":
if t not in ("unilateral_close", "htlc_resolution", "penalty"):
assert feerates['perkb'][t] == 25000
assert feerates['warning'] == 'Some fee estimates unavailable: bitcoind startup?'
assert 'perkw' not in feerates
@@ -1408,12 +1422,14 @@ def test_feerates(node_factory):
assert feerates['perkb']['min_acceptable'] == 253 * 4
# Set ECONOMICAL/100 feerate for min
l1.set_feerates((15000, 6250, 5000), True)
l1.set_feerates((15000, 11000, 6250, 5000), True)
wait_for(lambda: len(l1.rpc.feerates('perkw')['perkw']) >= len(types) + 2)
feerates = l1.rpc.feerates('perkw')
assert feerates['perkw']['unilateral_close'] == 15000
assert feerates['perkw']['htlc_resolution'] == 11000
assert feerates['perkw']['penalty'] == 11000
for t in types:
if t != "unilateral_close":
if t not in ("unilateral_close", "htlc_resolution", "penalty"):
assert feerates['perkw'][t] == 25000 // 4
assert 'warning' not in feerates
assert 'perkb' not in feerates