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

Function sphinx_compress

common/sphinx.c:915–935  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

913}
914
915struct sphinx_compressed_onion *
916sphinx_compress(const tal_t *ctx, const struct onionpacket *packet,
917 const struct sphinx_path *path)
918{
919 struct sphinx_compressed_onion *res;
920 size_t payloads_size = sphinx_path_payloads_size(path);
921
922 /* We can't compress an onion that doesn't have a rendez-vous node. */
923 if (path->rendezvous_id == NULL)
924 return NULL;
925
926 res = tal(ctx, struct sphinx_compressed_onion);
927 res->version = packet->version;
928 res->ephemeralkey = packet->ephemeralkey;
929 res->hmac = packet->hmac;
930
931 res->routinginfo = tal_arr(res, u8, payloads_size);
932 memcpy(res->routinginfo, packet->routinginfo, payloads_size);
933
934 return res;
935}
936
937u8 *sphinx_compressed_onion_serialize(const tal_t *ctx, const struct sphinx_compressed_onion *onion)
938{

Callers 1

do_generateFunction · 0.85

Calls 1

Tested by

no test coverage detected