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

Function routehint_pre_getroute

plugins/libplugin-pay.c:2672–2707  ·  view source on GitHub ↗

Change the destination and compute the final msatoshi amount to send to the * routehint entry point. */

Source from the content-addressed store, hash-verified

2670/* Change the destination and compute the final msatoshi amount to send to the
2671 * routehint entry point. */
2672static void routehint_pre_getroute(struct routehints_data *d, struct payment *p)
2673{
2674 bool have_more;
2675 d->current_routehint = next_routehint(d, p);
2676
2677 /* Signal that we could retry with another routehint even if getroute
2678 * fails. */
2679 have_more = (d->offset < tal_count(d->routehints) - 1);
2680 p->failroute_retry = have_more;
2681
2682 p->temp_exclusion = tal_free(p->temp_exclusion);
2683
2684 if (d->current_routehint != NULL) {
2685 if (!route_msatoshi(&p->getroute->amount, p->amount,
2686 d->current_routehint,
2687 tal_count(d->current_routehint))) {
2688 }
2689 d->final_cltv = p->getroute->cltv;
2690 p->getroute->destination = &d->current_routehint[0].pubkey;
2691 p->getroute->cltv =
2692 route_cltv(p->getroute->cltv, d->current_routehint,
2693 tal_count(d->current_routehint));
2694 paymod_log(
2695 p, LOG_DBG, "Using routehint %s (%s) cltv_delta=%d",
2696 type_to_string(tmpctx, struct node_id,
2697 &d->current_routehint->pubkey),
2698 type_to_string(tmpctx, struct short_channel_id,
2699 &d->current_routehint->short_channel_id),
2700 d->current_routehint->cltv_expiry_delta);
2701
2702 /* Exclude the entrypoint to the routehint, so we don't end up
2703 * going through the destination to the entrypoint. */
2704 p->temp_exclusion = routehint_generate_exclusion_list(p, d->current_routehint, p);
2705 } else
2706 paymod_log(p, LOG_DBG, "Not using a routehint");
2707}
2708
2709static void routehint_check_reachable(struct payment *p)
2710{

Callers 2

routehint_step_cbFunction · 0.85

Calls 7

next_routehintFunction · 0.85
tal_freeFunction · 0.85
route_msatoshiFunction · 0.85
route_cltvFunction · 0.85
paymod_logFunction · 0.85
type_to_stringClass · 0.50

Tested by

no test coverage detected