From 3e391793c5ea4c842dc1931ce993c82e6a3a2102 Mon Sep 17 00:00:00 2001 From: niftynei Date: Fri, 1 Oct 2021 17:19:10 -0500 Subject: [PATCH] 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 --- tests/test_pay.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/tests/test_pay.py b/tests/test_pay.py index f8ad178f4bc3..6d34d7c43b5b 100644 --- a/tests/test_pay.py +++ b/tests/test_pay.py @@ -2410,27 +2410,28 @@ def test_channel_spendable_receivable_capped(node_factory, bitcoind): assert l2.rpc.listpeers()['peers'][0]['channels'][0]['receivable_msat'] == Millisatoshi(0xFFFFFFFF) -@unittest.skipIf(True, "Test is extremely flaky") @unittest.skipIf(not DEVELOPER and VALGRIND, "Doesn't raise exception, needs better sync") def test_lockup_drain(node_factory, bitcoind): """Try to get channel into a state where opener can't afford fees on additional HTLC, so peer can't add HTLC""" - l1, l2 = node_factory.line_graph(2, opts={'may_reconnect': True}) + l1, l2 = node_factory.line_graph(2, opts={'may_reconnect': True, + 'feerates': (15000, 15000, 15000, 15000)}) # l1 sends all the money to l2 until even 1 msat can't get through. total = l1.drain(l2) - # Even if feerate now increases 2x (30000), l2 should be able to send + # Even if feerate now increases, l2 should be able to send # non-dust HTLC to l1. l1.force_feerates(30000) + assert total != 0 l2.pay(l1, total // 2) # reset fees and send all back again l1.force_feerates(15000) l1.drain(l2) - # But if feerate increase just a little more, l2 should not be able to send - # non-fust HTLC to l1 - l1.force_feerates(30002) # TODO: Why does 30001 fail? off by one in C code? + # But if feerate increases, l2 should not be able to send + # non-dust HTLC to l1 + l1.force_feerates(35000) # TODO: Why is this flaky af wait_for(lambda: l1.rpc.listpeers()['peers'][0]['connected']) with pytest.raises(RpcError, match=r".*Capacity exceeded.*"): l2.pay(l1, total // 2)