Skip to content

Commit fb8135d

Browse files
committed
tests: make test_lockup_drain a lot less flaky
The feerate at which a 'forced feerate' causes capacity to be exceeded is incredibly variable FIXME: investigate why, but for now use a feerate that's high enough to always trigger the capacity exceeded check
1 parent 7f40dbb commit fb8135d

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

tests/test_pay.py

+7-6
Original file line numberDiff line numberDiff line change
@@ -2410,27 +2410,28 @@ def test_channel_spendable_receivable_capped(node_factory, bitcoind):
24102410
assert l2.rpc.listpeers()['peers'][0]['channels'][0]['receivable_msat'] == Millisatoshi(0xFFFFFFFF)
24112411

24122412

2413-
@unittest.skipIf(True, "Test is extremely flaky")
24142413
@unittest.skipIf(not DEVELOPER and VALGRIND, "Doesn't raise exception, needs better sync")
24152414
def test_lockup_drain(node_factory, bitcoind):
24162415
"""Try to get channel into a state where opener can't afford fees on additional HTLC, so peer can't add HTLC"""
2417-
l1, l2 = node_factory.line_graph(2, opts={'may_reconnect': True})
2416+
l1, l2 = node_factory.line_graph(2, opts={'may_reconnect': True,
2417+
'feerates': (15000, 15000, 15000, 15000)})
24182418

24192419
# l1 sends all the money to l2 until even 1 msat can't get through.
24202420
total = l1.drain(l2)
24212421

2422-
# Even if feerate now increases 2x (30000), l2 should be able to send
2422+
# Even if feerate now increases, l2 should be able to send
24232423
# non-dust HTLC to l1.
24242424
l1.force_feerates(30000)
2425+
assert total != 0
24252426
l2.pay(l1, total // 2)
24262427

24272428
# reset fees and send all back again
24282429
l1.force_feerates(15000)
24292430
l1.drain(l2)
24302431

2431-
# But if feerate increase just a little more, l2 should not be able to send
2432-
# non-fust HTLC to l1
2433-
l1.force_feerates(30002) # TODO: Why does 30001 fail? off by one in C code?
2432+
# But if feerate increases, l2 should not be able to send
2433+
# non-dust HTLC to l1
2434+
l1.force_feerates(35000) # TODO: Why is this flaky af
24342435
wait_for(lambda: l1.rpc.listpeers()['peers'][0]['connected'])
24352436
with pytest.raises(RpcError, match=r".*Capacity exceeded.*"):
24362437
l2.pay(l1, total // 2)

0 commit comments

Comments
 (0)