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

Function test_lockup_drain

tests/test_pay.py:2613–2634  ·  view source on GitHub ↗

Try to get channel into a state where opener can't afford fees on additional HTLC, so peer can't add HTLC

(node_factory, bitcoind)

Source from the content-addressed store, hash-verified

2611@unittest.skipIf(True, "Test is extremely flaky")
2612@unittest.skipIf(not DEVELOPER and VALGRIND, "Doesn't raise exception, needs better sync")
2613def test_lockup_drain(node_factory, bitcoind):
2614 """Try to get channel into a state where opener can't afford fees on additional HTLC, so peer can't add HTLC"""
2615 l1, l2 = node_factory.line_graph(2, opts={'may_reconnect': True})
2616
2617 # l1 sends all the money to l2 until even 1 msat can't get through.
2618 total = l1.drain(l2)
2619
2620 # Even if feerate now increases 2x (30000), l2 should be able to send
2621 # non-dust HTLC to l1.
2622 l1.force_feerates(30000)
2623 l2.pay(l1, total // 2)
2624
2625 # reset fees and send all back again
2626 l1.force_feerates(15000)
2627 l1.drain(l2)
2628
2629 # But if feerate increase just a little more, l2 should not be able to send
2630 # non-fust HTLC to l1
2631 l1.force_feerates(30002) # TODO: Why does 30001 fail? off by one in C code?
2632 wait_for(lambda: l1.rpc.listpeers()['peers'][0]['connected'])
2633 with pytest.raises(RpcError, match=r".*Capacity exceeded.*"):
2634 l2.pay(l1, total // 2)
2635
2636
2637@pytest.mark.developer("needs DEVELOPER=1 for dev_ignore_htlcs")

Callers

nothing calls this directly

Calls 6

wait_forFunction · 0.90
line_graphMethod · 0.80
drainMethod · 0.80
force_feeratesMethod · 0.80
payMethod · 0.45
listpeersMethod · 0.45

Tested by

no test coverage detected