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

Function found_best_peer

plugins/offers_offer.c:300–322  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

298}
299
300static struct command_result *found_best_peer(struct command *cmd,
301 const struct chaninfo *best,
302 struct offer_info *offinfo)
303{
304 const struct offers_data *od = get_offers_data(cmd->plugin);
305
306 /* BOLT #12:
307 * - if it is connected only by private channels:
308 * - MUST include `offer_paths` containing one or more paths to the node from
309 * publicly reachable nodes.
310 */
311 if (!best) {
312 /* FIXME: Make this a warning in the result! */
313 plugin_log(cmd->plugin, LOG_UNUSUAL,
314 "No incoming channel to public peer, so no blinded path");
315 } else {
316 offinfo->offer->offer_paths
317 = offer_onehop_path(offinfo->offer, od,
318 offinfo->offer, &best->id);
319 }
320
321 return create_offer(cmd, offinfo);
322}
323
324static struct command_result *maybe_add_path(struct command *cmd,
325 struct offer_info *offinfo)

Callers

nothing calls this directly

Calls 4

get_offers_dataFunction · 0.85
offer_onehop_pathFunction · 0.85
create_offerFunction · 0.85
plugin_logFunction · 0.70

Tested by

no test coverage detected