| 2845 | } |
| 2846 | |
| 2847 | static struct route_info *next_routehint(struct routehints_data *d, |
| 2848 | struct payment *p) |
| 2849 | { |
| 2850 | size_t numhints = tal_count(d->routehints); |
| 2851 | struct route_info *curr; |
| 2852 | |
| 2853 | if (d->routehints == NULL || numhints == 0) |
| 2854 | return NULL; |
| 2855 | |
| 2856 | /* BOLT #11: |
| 2857 | * |
| 2858 | * - if a writer offers more than one of any field type, it: |
| 2859 | * - MUST specify the most-preferred field first, followed |
| 2860 | * by less-preferred fields, in order. |
| 2861 | */ |
| 2862 | for (; d->offset < numhints; d->offset++) { |
| 2863 | curr = d->routehints[(d->base + d->offset) % numhints]; |
| 2864 | if (curr == NULL || !routehint_excluded(p, curr)) |
| 2865 | return curr; |
| 2866 | } |
| 2867 | return NULL; |
| 2868 | } |
| 2869 | |
| 2870 | /* Calculate how many millisatoshi we need at the start of this route |
| 2871 | * to get msatoshi to the end. */ |
no test coverage detected