| 2861 | } |
| 2862 | |
| 2863 | static struct route_info *next_routehint(struct routehints_data *d, |
| 2864 | struct payment *p) |
| 2865 | { |
| 2866 | size_t numhints = tal_count(d->routehints); |
| 2867 | struct route_info *curr; |
| 2868 | |
| 2869 | if (d->routehints == NULL || numhints == 0) |
| 2870 | return NULL; |
| 2871 | |
| 2872 | /* BOLT #11: |
| 2873 | * |
| 2874 | * - if a writer offers more than one of any field type, it: |
| 2875 | * - MUST specify the most-preferred field first, followed |
| 2876 | * by less-preferred fields, in order. |
| 2877 | */ |
| 2878 | for (; d->offset < numhints; d->offset++) { |
| 2879 | curr = d->routehints[(d->base + d->offset) % numhints]; |
| 2880 | if (curr == NULL || !routehint_excluded(p, curr)) |
| 2881 | return curr; |
| 2882 | } |
| 2883 | return NULL; |
| 2884 | } |
| 2885 | |
| 2886 | /* Calculate how many millisatoshi we need at the start of this route |
| 2887 | * to get msatoshi to the end. */ |
no test coverage detected