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

Function test_htlc_failed_noclose

tests/test_connection.py:3869–3892  ·  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

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

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