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

Function sphinx_compress

common/sphinx.c:837–857  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

835}
836
837struct sphinx_compressed_onion *
838sphinx_compress(const tal_t *ctx, const struct onionpacket *packet,
839 const struct sphinx_path *path)
840{
841 struct sphinx_compressed_onion *res;
842 size_t payloads_size = sphinx_path_payloads_size(path);
843
844 /* We can't compress an onion that doesn't have a rendez-vous node. */
845 if (path->rendezvous_id == NULL)
846 return NULL;
847
848 res = tal(ctx, struct sphinx_compressed_onion);
849 res->version = packet->version;
850 res->ephemeralkey = packet->ephemeralkey;
851 res->hmac = packet->hmac;
852
853 res->routinginfo = tal_arr(res, u8, payloads_size);
854 memcpy(res->routinginfo, packet->routinginfo, payloads_size);
855
856 return res;
857}
858
859u8 *sphinx_compressed_onion_serialize(const tal_t *ctx, const struct sphinx_compressed_onion *onion)
860{

Callers 1

do_generateFunction · 0.85

Calls 1

Tested by

no test coverage detected