An extra part arriving while the invoice_payment hook is pending must not re-dispatch the (already complete) HTLC set.
(node_factory)
| 2656 | |
| 2657 | |
| 2658 | def test_htlc_set_part_during_invoice_hook(node_factory): |
| 2659 | """An extra part arriving while the invoice_payment hook is pending |
| 2660 | must not re-dispatch the (already complete) HTLC set.""" |
| 2661 | l1, l2, l3 = node_factory.get_nodes(3, opts=[{}, |
| 2662 | {'plugin': os.path.join(os.getcwd(), 'tests/plugins/hold_invoice.py')}, |
| 2663 | {}]) |
| 2664 | node_factory.join_nodes([l1, l2]) |
| 2665 | node_factory.join_nodes([l3, l2]) |
| 2666 | |
| 2667 | inv = l2.rpc.invoice(1000, 'inv', 'for testing') |
| 2668 | payment_hash = inv['payment_hash'] |
| 2669 | |
| 2670 | # First part completes the set, and the hook holds it. |
| 2671 | l1.rpc.sendpay(l1.single_route(l2.info['id'], 1000), payment_hash, |
| 2672 | payment_secret=inv['payment_secret']) |
| 2673 | l2.daemon.wait_for_log('HTLC set contains 1 HTLCs, for a total of 1000msat out of 1000msat') |
| 2674 | |
| 2675 | # Another part for the same set, while hook is still pending. |
| 2676 | l3.rpc.sendpay(l3.single_route(l2.info['id'], 1000), payment_hash, |
| 2677 | payment_secret=inv['payment_secret']) |
| 2678 | l2.daemon.wait_for_log('HTLC set contains 2 HTLCs, for a total of 2000msat out of 1000msat') |
| 2679 | |
| 2680 | open(os.path.join(l2.daemon.lightning_dir, TEST_NETWORK, "unhold"), "w").close() |
| 2681 | l1.rpc.waitsendpay(payment_hash, TIMEOUT) |
| 2682 | l3.rpc.waitsendpay(payment_hash, TIMEOUT) |
| 2683 | |
| 2684 | inv = only_one(l2.rpc.listinvoices('inv')['invoices']) |
| 2685 | assert inv['status'] == 'paid' |
| 2686 | assert inv['amount_received_msat'] == Millisatoshi(1000) |
| 2687 | assert l2.daemon.is_in_log('Resolved invoice .* in 2 htlcs') |
| 2688 | |
| 2689 | |
| 2690 | def test_channel_receivable(node_factory, bitcoind): |
nothing calls this directly
no test coverage detected