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

Function test_htlc_failed_noclose

tests/test_connection.py:3864–3887  ·  view source on GitHub ↗

Test a bug where the htlc timeout would kick in even if the HTLC failed

(node_factory)

Source from the content-addressed store, hash-verified

3862
3863
3864def test_htlc_failed_noclose(node_factory):
3865 """Test a bug where the htlc timeout would kick in even if the HTLC failed"""
3866 l1, l2 = node_factory.line_graph(2)
3867
3868 inv = l2.rpc.invoice(1000, "test", "test")
3869 routestep = {
3870 'amount_msat': FUNDAMOUNT * 1000,
3871 'id': l2.info['id'],
3872 'delay': 5,
3873 'channel': first_scid(l1, l2)
3874 }
3875
3876 # This fails at channeld
3877 l1.rpc.sendpay([routestep], inv['payment_hash'], payment_secret=inv['payment_secret'])
3878 with pytest.raises(RpcError, match="Capacity exceeded"):
3879 l1.rpc.waitsendpay(inv['payment_hash'])
3880
3881 # Send a second one, too: make sure we don't crash.
3882 l1.rpc.sendpay([routestep], inv['payment_hash'], payment_secret=inv['payment_secret'])
3883 with pytest.raises(RpcError, match="Capacity exceeded"):
3884 l1.rpc.waitsendpay(inv['payment_hash'])
3885
3886 time.sleep(35)
3887 assert l1.rpc.getpeer(l2.info['id'])['connected']
3888
3889
3890@pytest.mark.openchannel('v1')

Callers

nothing calls this directly

Calls 6

first_scidFunction · 0.90
line_graphMethod · 0.80
sendpayMethod · 0.80
waitsendpayMethod · 0.80
invoiceMethod · 0.45
getpeerMethod · 0.45

Tested by

no test coverage detected