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

Function found_best_peer

plugins/offers_offer.c:305–327  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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