Test that we discard a set when the HTLC is lost
(node_factory, bitcoind)
| 3347 | |
| 3348 | |
| 3349 | def 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 | |
| 3376 | def test_createonion_limits(node_factory): |
nothing calls this directly
no test coverage detected