Commit e48b8f8
committed
f: dispatch trampoline MPP via public send_payment_with_route
Review comment from valentinewallace on lightning/src/ln/blinded_payment_tests.rs:2861:
> Generally preferred to use the public API in tests. I clauded this
> patch but haven't vetted it much, let me know your thoughts:
> valentinewallace@79a0771
Adopt the patch's core idea:
* Extend `create_trampoline_forward_blinded_tail` to also return the
underlying `BlindedPaymentPath` so callers can register it in
`PaymentParameters`. Update the existing single-path caller to use
`.0` on the new tuple.
* Build `PaymentParameters::blinded(vec![path_bob, path_barry])` from
the two paths and dispatch the MPP via `send_payment_with_route`
instead of `test_add_new_pending_payment` +
`test_send_payment_along_path`. The registered blinded paths are
required, not decorative: `insert_previously_failed_blinded_path`
(outbound_payment.rs:2508) is invoked on the trampoline rejection /
timeout failures this test exercises, and `debug_assert!`s that the
failing tail is registered in payment_params.
Also bump Carol's outer-hop `cltv_expiry_delta` from
`trampoline_cltv + excess_final_cltv` (112) to `carol_relay.cltv_
expiry_delta + trampoline_cltv + excess_final_cltv` (184). Required by
`FixedRouter` (router.rs:765-773), which validates that the last outer-
hop's `cltv_expiry_delta` equals `sum(trampoline_hops[*].cltv_expiry_
delta)`. That sum is `blinded_path.payinfo.cltv_expiry_delta +
excess_final_cltv_delta`, and the payinfo aggregates the intermediate
trampoline relay's `cltv_expiry_delta` (= `carol_relay.cltv_expiry_
delta` from `fwd_tail`) plus `min_final_cltv_expiry_delta`
(= `trampoline_cltv`). The `test_send_payment_along_path` helpers
bypassed this validation, so 112 worked there; the public API does
not. Reverting to 112 panics with "Path had a total trampoline CLTV of
184, which is not equal to the total last-hop CLTV delta of 112".
Comment the derivation at the call site so the overloaded "relay"
naming doesn't trip up future readers.
Return `last_hop_cltv_delta` from `send_trampoline_mpp_payment` so the
on-chain timeout branch can compute Carol's incoming HTLC CLTV from
the same value the route is built with, rather than re-stating the
magic constant 184 in two places.1 parent 5ba7094 commit e48b8f8
2 files changed
Lines changed: 51 additions & 55 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2597 | 2597 | | |
2598 | 2598 | | |
2599 | 2599 | | |
2600 | | - | |
2601 | | - | |
2602 | | - | |
2603 | | - | |
2604 | | - | |
2605 | | - | |
2606 | | - | |
2607 | | - | |
2608 | | - | |
2609 | | - | |
2610 | | - | |
| 2600 | + | |
| 2601 | + | |
| 2602 | + | |
| 2603 | + | |
| 2604 | + | |
| 2605 | + | |
| 2606 | + | |
| 2607 | + | |
| 2608 | + | |
| 2609 | + | |
| 2610 | + | |
| 2611 | + | |
| 2612 | + | |
| 2613 | + | |
2611 | 2614 | | |
2612 | | - | |
2613 | | - | |
2614 | | - | |
2615 | | - | |
2616 | | - | |
2617 | | - | |
| 2615 | + | |
| 2616 | + | |
| 2617 | + | |
| 2618 | + | |
| 2619 | + | |
| 2620 | + | |
2618 | 2621 | | |
2619 | 2622 | | |
2620 | 2623 | | |
| |||
2736 | 2739 | | |
2737 | 2740 | | |
2738 | 2741 | | |
2739 | | - | |
| 2742 | + | |
2740 | 2743 | | |
2741 | 2744 | | |
2742 | | - | |
| 2745 | + | |
2743 | 2746 | | |
2744 | 2747 | | |
2745 | 2748 | | |
| |||
2822 | 2825 | | |
2823 | 2826 | | |
2824 | 2827 | | |
| 2828 | + | |
| 2829 | + | |
2825 | 2830 | | |
2826 | 2831 | | |
2827 | 2832 | | |
2828 | | - | |
| 2833 | + | |
2829 | 2834 | | |
2830 | 2835 | | |
2831 | 2836 | | |
2832 | | - | |
2833 | | - | |
| 2837 | + | |
| 2838 | + | |
| 2839 | + | |
| 2840 | + | |
| 2841 | + | |
| 2842 | + | |
| 2843 | + | |
| 2844 | + | |
| 2845 | + | |
2834 | 2846 | | |
2835 | 2847 | | |
2836 | 2848 | | |
2837 | | - | |
| 2849 | + | |
2838 | 2850 | | |
2839 | 2851 | | |
2840 | 2852 | | |
2841 | | - | |
| 2853 | + | |
2842 | 2854 | | |
2843 | 2855 | | |
2844 | | - | |
| 2856 | + | |
2845 | 2857 | | |
2846 | 2858 | | |
2847 | | - | |
2848 | 2859 | | |
2849 | 2860 | | |
2850 | | - | |
2851 | | - | |
2852 | | - | |
2853 | | - | |
2854 | | - | |
2855 | | - | |
2856 | | - | |
2857 | | - | |
2858 | | - | |
2859 | | - | |
2860 | | - | |
2861 | | - | |
2862 | | - | |
2863 | | - | |
2864 | | - | |
2865 | | - | |
2866 | | - | |
2867 | | - | |
2868 | | - | |
2869 | | - | |
2870 | | - | |
2871 | | - | |
2872 | | - | |
| 2861 | + | |
| 2862 | + | |
2873 | 2863 | | |
2874 | 2864 | | |
2875 | 2865 | | |
2876 | 2866 | | |
2877 | 2867 | | |
2878 | | - | |
| 2868 | + | |
2879 | 2869 | | |
2880 | 2870 | | |
2881 | 2871 | | |
| |||
2892 | 2882 | | |
2893 | 2883 | | |
2894 | 2884 | | |
2895 | | - | |
| 2885 | + | |
| 2886 | + | |
2896 | 2887 | | |
2897 | 2888 | | |
2898 | 2889 | | |
| |||
2921 | 2912 | | |
2922 | 2913 | | |
2923 | 2914 | | |
2924 | | - | |
| 2915 | + | |
2925 | 2916 | | |
2926 | 2917 | | |
2927 | 2918 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5776 | 5776 | | |
5777 | 5777 | | |
5778 | 5778 | | |
| 5779 | + | |
| 5780 | + | |
| 5781 | + | |
| 5782 | + | |
5779 | 5783 | | |
5780 | 5784 | | |
5781 | 5785 | | |
5782 | 5786 | | |
5783 | 5787 | | |
5784 | | - | |
| 5788 | + | |
5785 | 5789 | | |
5786 | 5790 | | |
5787 | 5791 | | |
| |||
5794 | 5798 | | |
5795 | 5799 | | |
5796 | 5800 | | |
5797 | | - | |
| 5801 | + | |
5798 | 5802 | | |
5799 | 5803 | | |
5800 | 5804 | | |
| |||
5813 | 5817 | | |
5814 | 5818 | | |
5815 | 5819 | | |
5816 | | - | |
| 5820 | + | |
| 5821 | + | |
5817 | 5822 | | |
0 commit comments