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

Function sphinx_append_blinded_path

plugins/renepay/routetracker.c:255–282  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

253}
254
255static void sphinx_append_blinded_path(const tal_t *ctx,
256 struct sphinx_path *sp,
257 const struct blinded_path *blinded_path,
258 const struct amount_msat deliver,
259 const struct amount_msat total,
260 const u32 final_cltv)
261{
262 const size_t pathlen = tal_count(blinded_path->path);
263 bool ret;
264
265 for (size_t i = 0; i < pathlen; i++) {
266 bool first = (i == 0);
267 bool final = (i == pathlen - 1);
268
269 const struct blinded_path_hop *bhop = blinded_path->path[i];
270 const u8 *payload = onion_blinded_hop(
271 ctx, final ? &deliver : NULL, final ? &total : NULL,
272 final ? &final_cltv : NULL, bhop->encrypted_recipient_data,
273 first ? &blinded_path->first_path_key : NULL);
274 // FIXME: better handle error here
275 ret = sphinx_add_hop_has_length(
276 sp,
277 first ? &blinded_path->first_node_id.pubkey
278 : &bhop->blinded_node_id,
279 take(payload));
280 assert(ret);
281 }
282}
283
284static void sphinx_append_final_hop(const tal_t *ctx,
285 struct sphinx_path *sp,

Callers 1

create_onionFunction · 0.85

Calls 2

onion_blinded_hopFunction · 0.85

Tested by

no test coverage detected