MCPcopy Create free account
hub / github.com/ElementsProject/lightning / next_routehint

Function next_routehint

plugins/libplugin-pay.c:2577–2598  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2575}
2576
2577static 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. */

Callers 1

routehint_pre_getrouteFunction · 0.85

Calls 1

routehint_excludedFunction · 0.85

Tested by

no test coverage detected