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

Function routehints_done

plugins/renepay/mods.c:552–594  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

550}
551
552static struct command_result *routehints_done(struct command *cmd UNUSED,
553 const char *method UNUSED,
554 const char *buf UNUSED,
555 const jsmntok_t *result UNUSED,
556 struct payment *payment)
557{
558 // FIXME are there route hints for B12?
559 assert(payment);
560 assert(payment->local_gossmods);
561
562 const struct node_id *destination = &payment->payment_info.destination;
563 struct route_info **routehints = payment->payment_info.routehints;
564 assert(routehints);
565 const size_t nhints = tal_count(routehints);
566 /* Hints are added to the local_gossmods. */
567 for (size_t i = 0; i < nhints; i++) {
568 /* Each one, presumably, leads to the destination */
569 const struct route_info *r = routehints[i];
570 const struct node_id *end = destination;
571
572 for (int j = tal_count(r) - 1; j >= 0; j--) {
573 add_hintchan(payment, &r[j].pubkey, end,
574 r[j].cltv_expiry_delta,
575 r[j].short_channel_id, r[j].fee_base_msat,
576 r[j].fee_proportional_millionths,
577 NULL, NULL);
578 end = &r[j].pubkey;
579 }
580 }
581
582 /* Add hints to the uncertainty network. */
583 gossmap_apply_localmods(pay_plugin->gossmap, payment->local_gossmods);
584 int skipped_count =
585 uncertainty_update(pay_plugin->uncertainty, pay_plugin->gossmap);
586 gossmap_remove_localmods(pay_plugin->gossmap, payment->local_gossmods);
587 if (skipped_count)
588 plugin_log(pay_plugin->plugin, LOG_UNUSUAL,
589 "%s: uncertainty was updated but %d channels have "
590 "been ignored.",
591 __func__, skipped_count);
592
593 return payment_continue(payment);
594}
595
596static struct command_result *routehints_cb(struct payment *payment)
597{

Callers

nothing calls this directly

Calls 6

add_hintchanFunction · 0.85
gossmap_apply_localmodsFunction · 0.85
uncertainty_updateFunction · 0.85
gossmap_remove_localmodsFunction · 0.85
payment_continueFunction · 0.70
plugin_logFunction · 0.50

Tested by

no test coverage detected