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

Function offer_onehop_paths

plugins/offers_offer.c:257–289  ·  view source on GitHub ↗

Create num_node_ids paths from these node_ids to us (one hop each) */

Source from the content-addressed store, hash-verified

255
256/* Create num_node_ids paths from these node_ids to us (one hop each) */
257static struct blinded_path **offer_onehop_paths(const tal_t *ctx,
258 const struct offers_data *od,
259 const struct tlv_offer *offer,
260 const struct pubkey *neighbors,
261 size_t num_neighbors)
262{
263 struct pubkey *ids = tal_arr(tmpctx, struct pubkey, 2);
264 struct secret blinding_path_secret;
265 struct sha256 offer_id;
266 struct blinded_path **offer_paths;
267
268 /* Note: "id" of offer minus paths */
269 assert(!offer->offer_paths);
270 offer_offer_id(offer, &offer_id);
271
272 offer_paths = tal_arr(ctx, struct blinded_path *, num_neighbors);
273 for (size_t i = 0; i < num_neighbors; i++) {
274 ids[0] = neighbors[i];
275 ids[1] = od->id;
276
277 /* So we recognize this */
278 /* We can check this when they try to take up offer. */
279 bolt12_path_secret(&od->offerblinding_base, &offer_id,
280 &blinding_path_secret);
281
282 offer_paths[i]
283 = incoming_message_blinded_path(offer_paths,
284 ids,
285 NULL,
286 &blinding_path_secret);
287 }
288 return offer_paths;
289}
290
291/* Common case of making a single path */
292static struct blinded_path **offer_onehop_path(const tal_t *ctx,

Callers 2

offer_onehop_pathFunction · 0.85
maybe_add_pathFunction · 0.85

Calls 3

offer_offer_idFunction · 0.85
bolt12_path_secretFunction · 0.85

Tested by

no test coverage detected