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

Function sphinx_compress

common/sphinx.c:923–943  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 1

do_generateFunction · 0.85

Calls 1

Tested by

no test coverage detected