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

Function test_partial_payment_htlc_loss

tests/test_pay.py:3349–3373  ·  view source on GitHub ↗

Test that we discard a set when the HTLC is lost

(node_factory, bitcoind)

Source from the content-addressed store, hash-verified

3347
3348
3349def test_partial_payment_htlc_loss(node_factory, bitcoind):
3350 """Test that we discard a set when the HTLC is lost"""
3351 # We want l2 to fail once it has completed first htlc.
3352 l1, l2, l3 = node_factory.line_graph(3, wait_for_announce=True,
3353 opts=[{},
3354 {'disconnect': ['=WIRE_UPDATE_ADD_HTLC', '+WIRE_REVOKE_AND_ACK']},
3355 {}])
3356
3357 inv = l3.rpc.invoice(1000, 'inv', 'inv')
3358 paysecret = l3.rpc.decode(inv['bolt11'])['payment_secret']
3359
3360 route = l1.single_route(l3.info['id'], 500)
3361
3362 l1.rpc.sendpay(route=route, payment_hash=inv['payment_hash'], amount_msat=1000, bolt11=inv['bolt11'], payment_secret=paysecret, partid=1)
3363
3364 wait_for(lambda: not only_one(l2.rpc.listpeers(l3.info['id'])['peers'])['connected'])
3365 l2.rpc.dev_fail(l3.info['id'])
3366
3367 # Since HTLC is missing from commit (dust), it's closed as soon as l2 sees
3368 # it onchain. l3 shouldn't crash though.
3369 bitcoind.generate_block(1, wait_for_mempool=1)
3370
3371 with pytest.raises(RpcError,
3372 match=r'WIRE_PERMANENT_CHANNEL_FAILURE \(reply from remote\)'):
3373 l1.rpc.waitsendpay(payment_hash=inv['payment_hash'], timeout=TIMEOUT, partid=1)
3374
3375
3376def test_createonion_limits(node_factory):

Callers

nothing calls this directly

Calls 11

wait_forFunction · 0.90
only_oneFunction · 0.90
line_graphMethod · 0.80
single_routeMethod · 0.80
sendpayMethod · 0.80
dev_failMethod · 0.80
generate_blockMethod · 0.80
waitsendpayMethod · 0.80
invoiceMethod · 0.45
decodeMethod · 0.45
listpeersMethod · 0.45

Tested by

no test coverage detected