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

Function maybe_add_path

plugins/offers_offer.c:329–359  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

327}
328
329static struct command_result *maybe_add_path(struct command *cmd,
330 struct offer_info *offinfo)
331{
332 const struct offers_data *od = get_offers_data(cmd->plugin);
333
334 /* Populate paths assuming not already set by dev_paths */
335 if (!offinfo->offer->offer_paths) {
336 /* BOLT #12:
337 * - if it is connected only by private channels:
338 * - MUST include `offer_paths` containing one or more paths to the node from
339 * publicly reachable nodes.
340 */
341 if (we_want_blinded_path(cmd->plugin, offinfo->fronting_nodes, false)) {
342 /* We use *all* fronting nodes (not just "best" one)
343 * for offers */
344 if (offinfo->fronting_nodes) {
345 offinfo->offer->offer_paths
346 = offer_onehop_paths(offinfo->offer, od,
347 offinfo->offer,
348 offinfo->fronting_nodes,
349 tal_count(offinfo->fronting_nodes));
350 } else {
351 return find_best_peer(cmd, 1ULL << OPT_ONION_MESSAGES,
352 NULL, NULL,
353 found_best_peer, offinfo);
354 }
355 }
356 }
357
358 return create_offer(cmd, offinfo);
359}
360
361static struct command_result *currency_done(struct command *cmd,
362 const char *method,

Callers 2

currency_doneFunction · 0.85
json_offerFunction · 0.85

Calls 4

get_offers_dataFunction · 0.85
we_want_blinded_pathFunction · 0.85
offer_onehop_pathsFunction · 0.85
create_offerFunction · 0.85

Tested by

no test coverage detected