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

Function onion_nonfinal_hop

common/onion.c:39–64  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

37}
38
39u8 *onion_nonfinal_hop(const tal_t *ctx,
40 const struct short_channel_id *scid,
41 struct amount_msat forward,
42 u32 outgoing_cltv,
43 const struct pubkey *blinding,
44 const u8 *enctlv)
45{
46 struct tlv_tlv_payload *tlv = tlv_tlv_payload_new(tmpctx);
47
48 /* BOLT #4:
49 *
50 * The writer:
51 *...
52 * - For every node:
53 * - MUST include `amt_to_forward` and `outgoing_cltv_value`.
54 * - For every non-final node:
55 * - MUST include `short_channel_id`
56 * - MUST NOT include `payment_data`
57 */
58 tlv->amt_to_forward = &forward.millisatoshis; /* Raw: TLV convert */
59 tlv->outgoing_cltv_value = &outgoing_cltv;
60 tlv->short_channel_id = cast_const(struct short_channel_id *, scid);
61 tlv->blinding_point = cast_const(struct pubkey *, blinding);
62 tlv->encrypted_recipient_data = cast_const(u8 *, enctlv);
63 return make_tlv_hop(ctx, tlv);
64}
65
66u8 *onion_final_hop(const tal_t *ctx,
67 struct amount_msat forward,

Callers 2

send_paymentFunction · 0.85
do_generateFunction · 0.85

Calls 1

make_tlv_hopFunction · 0.85

Tested by

no test coverage detected