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

Function maybe_add_path

plugins/offers_offer.c:324–354  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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