| 2575 | } |
| 2576 | |
| 2577 | static struct route_info *next_routehint(struct routehints_data *d, |
| 2578 | struct payment *p) |
| 2579 | { |
| 2580 | size_t numhints = tal_count(d->routehints); |
| 2581 | struct route_info *curr; |
| 2582 | |
| 2583 | if (d->routehints == NULL || numhints == 0) |
| 2584 | return NULL; |
| 2585 | |
| 2586 | /* BOLT #11: |
| 2587 | * |
| 2588 | * - if a writer offers more than one of any field type, it: |
| 2589 | * - MUST specify the most-preferred field first, followed |
| 2590 | * by less-preferred fields, in order. |
| 2591 | */ |
| 2592 | for (; d->offset < numhints; d->offset++) { |
| 2593 | curr = d->routehints[(d->base + d->offset) % numhints]; |
| 2594 | if (curr == NULL || !routehint_excluded(p, curr)) |
| 2595 | return curr; |
| 2596 | } |
| 2597 | return NULL; |
| 2598 | } |
| 2599 | |
| 2600 | /* Calculate how many millisatoshi we need at the start of this route |
| 2601 | * to get msatoshi to the end. */ |
no test coverage detected