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

Function sphinx_add_hop_has_length

common/sphinx.c:110–128  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

108}
109
110bool sphinx_add_hop_has_length(struct sphinx_path *path, const struct pubkey *pubkey,
111 const u8 *payload TAKES)
112{
113 struct sphinx_hop sp;
114 bigsize_t lenlen, prepended_len;
115
116 /* In case length is missing, we'll return false. */
117 prepended_len = UINT64_MAX;
118 lenlen = bigsize_get(payload, tal_bytelen(payload), &prepended_len);
119 if (add_overflows_u64(lenlen, prepended_len))
120 return false;
121 if (lenlen + prepended_len != tal_bytelen(payload))
122 return false;
123
124 sp.raw_payload = tal_dup_talarr(path, u8, payload);
125 sp.pubkey = *pubkey;
126 tal_arr_expand(&path->hops, sp);
127 return true;
128}
129
130static u8 *make_v0_hop(const tal_t *ctx,
131 const struct short_channel_id *scid,

Callers 10

send_paymentFunction · 0.85
json_createonionFunction · 0.85
sphinx_add_hopFunction · 0.85
mainFunction · 0.85
sphinx_append_final_hopFunction · 0.85
create_onionFunction · 0.85
append_blinded_payloadsFunction · 0.85
create_onionFunction · 0.85
do_generateFunction · 0.85

Calls 3

tal_bytelenFunction · 0.85
add_overflows_u64Function · 0.85
bigsize_getFunction · 0.70

Tested by 1

mainFunction · 0.68