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

Function routehint_pre_getroute

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

2940/* Change the destination and compute the final msatoshi amount to send to the
2941 * routehint entry point. */
2942static void routehint_pre_getroute(struct routehints_data *d, struct payment *p)
2943{
2944 bool have_more;
2945 d->current_routehint = next_routehint(d, p);
2946
2947 /* Signal that we could retry with another routehint even if getroute
2948 * fails. */
2949 have_more = (d->offset < tal_count(d->routehints) - 1);
2950 p->failroute_retry = have_more;
2951
2952 p->temp_exclusion = tal_free(p->temp_exclusion);
2953
2954 if (d->current_routehint != NULL) {
2955 if (!route_msatoshi(&p->getroute->amount, p->our_amount,
2956 d->current_routehint,
2957 tal_count(d->current_routehint))) {
2958 }
2959 d->final_cltv = p->getroute->cltv;
2960 p->getroute->destination = &d->current_routehint[0].pubkey;
2961 p->getroute->cltv =
2962 route_cltv(p->getroute->cltv, d->current_routehint,
2963 tal_count(d->current_routehint));
2964 paymod_log(
2965 p, LOG_DBG, "Using routehint %s (%s) cltv_delta=%d",
2966 fmt_node_id(tmpctx, &d->current_routehint->pubkey),
2967 fmt_short_channel_id(tmpctx,
2968 d->current_routehint->short_channel_id),
2969 d->current_routehint->cltv_expiry_delta);
2970
2971 /* Exclude the entrypoint to the routehint, so we don't end up
2972 * going through the destination to the entrypoint. */
2973 p->temp_exclusion = routehint_generate_exclusion_list(p, d->current_routehint, p);
2974 } else
2975 paymod_log(p, LOG_DBG, "Not using a routehint");
2976}
2977
2978static struct command_result *routehint_check_reachable(struct payment *p)
2979{

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