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

Function test_htlc_failed_noclose

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

3813
3814
3815def test_htlc_failed_noclose(node_factory):
3816 """Test a bug where the htlc timeout would kick in even if the HTLC failed"""
3817 l1, l2 = node_factory.line_graph(2)
3818
3819 inv = l2.rpc.invoice(1000, "test", "test")
3820 routestep = {
3821 'amount_msat': FUNDAMOUNT * 1000,
3822 'id': l2.info['id'],
3823 'delay': 5,
3824 'channel': first_scid(l1, l2)
3825 }
3826
3827 # This fails at channeld
3828 l1.rpc.sendpay([routestep], inv['payment_hash'], payment_secret=inv['payment_secret'])
3829 with pytest.raises(RpcError, match="Capacity exceeded"):
3830 l1.rpc.waitsendpay(inv['payment_hash'])
3831
3832 # Send a second one, too: make sure we don't crash.
3833 l1.rpc.sendpay([routestep], inv['payment_hash'], payment_secret=inv['payment_secret'])
3834 with pytest.raises(RpcError, match="Capacity exceeded"):
3835 l1.rpc.waitsendpay(inv['payment_hash'])
3836
3837 time.sleep(35)
3838 assert l1.rpc.getpeer(l2.info['id'])['connected']
3839
3840
3841@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