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

Function routehint_pre_getroute

plugins/libplugin-pay.c:2958–2992  ·  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

2956/* Change the destination and compute the final msatoshi amount to send to the
2957 * routehint entry point. */
2958static void routehint_pre_getroute(struct routehints_data *d, struct payment *p)
2959{
2960 bool have_more;
2961 d->current_routehint = next_routehint(d, p);
2962
2963 /* Signal that we could retry with another routehint even if getroute
2964 * fails. */
2965 have_more = (d->offset < tal_count(d->routehints) - 1);
2966 p->failroute_retry = have_more;
2967
2968 p->temp_exclusion = tal_free(p->temp_exclusion);
2969
2970 if (d->current_routehint != NULL) {
2971 if (!route_msatoshi(&p->getroute->amount, p->our_amount,
2972 d->current_routehint,
2973 tal_count(d->current_routehint))) {
2974 }
2975 d->final_cltv = p->getroute->cltv;
2976 p->getroute->destination = &d->current_routehint[0].pubkey;
2977 p->getroute->cltv =
2978 route_cltv(p->getroute->cltv, d->current_routehint,
2979 tal_count(d->current_routehint));
2980 paymod_log(
2981 p, LOG_DBG, "Using routehint %s (%s) cltv_delta=%d",
2982 fmt_node_id(tmpctx, &d->current_routehint->pubkey),
2983 fmt_short_channel_id(tmpctx,
2984 d->current_routehint->short_channel_id),
2985 d->current_routehint->cltv_expiry_delta);
2986
2987 /* Exclude the entrypoint to the routehint, so we don't end up
2988 * going through the destination to the entrypoint. */
2989 p->temp_exclusion = routehint_generate_exclusion_list(p, d->current_routehint, p);
2990 } else
2991 paymod_log(p, LOG_DBG, "Not using a routehint");
2992}
2993
2994static struct command_result *routehint_check_reachable(struct payment *p)
2995{

Callers 2

routehint_step_cbFunction · 0.85

Calls 8

next_routehintFunction · 0.85
tal_freeFunction · 0.85
route_msatoshiFunction · 0.85
route_cltvFunction · 0.85
paymod_logFunction · 0.85
fmt_node_idFunction · 0.85
fmt_short_channel_idFunction · 0.85

Tested by

no test coverage detected