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

Function serialize_onionpacket

common/sphinx.c:151–166  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

149}
150
151u8 *serialize_onionpacket(
152 const tal_t *ctx,
153 const struct onionpacket *m)
154{
155 u8 *dst = tal_arr(ctx, u8, TOTAL_PACKET_SIZE(tal_bytelen(m->routinginfo)));
156
157 u8 der[PUBKEY_CMPR_LEN];
158 int p = 0;
159
160 pubkey_to_der(der, &m->ephemeralkey);
161 write_buffer(dst, &m->version, 1, &p);
162 write_buffer(dst, der, sizeof(der), &p);
163 write_buffer(dst, m->routinginfo, tal_bytelen(m->routinginfo), &p);
164 write_buffer(dst, m->hmac.bytes, sizeof(m->hmac.bytes), &p);
165 return dst;
166}
167
168struct onionpacket *parse_onionpacket(const tal_t *ctx,
169 const u8 *src,

Callers 13

handle_onion_messageFunction · 0.50
send_onionFunction · 0.50
json_createonionFunction · 0.50
json_sendonionmessageFunction · 0.50
htlc_accepted_hook_finalFunction · 0.50
peer_accepted_htlcFunction · 0.50
next_onionFunction · 0.50
mainFunction · 0.50
mainFunction · 0.50
do_generateFunction · 0.50
do_decodeFunction · 0.50
runtestFunction · 0.50

Calls 3

tal_bytelenFunction · 0.85
write_bufferFunction · 0.85
pubkey_to_derFunction · 0.50

Tested by 3

next_onionFunction · 0.40
mainFunction · 0.40
mainFunction · 0.40