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

Function sphinx_compress

common/sphinx.c:949–969  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

947}
948
949struct sphinx_compressed_onion *
950sphinx_compress(const tal_t *ctx, const struct onionpacket *packet,
951 const struct sphinx_path *path)
952{
953 struct sphinx_compressed_onion *res;
954 size_t payloads_size = sphinx_path_payloads_size(path);
955
956 /* We can't compress an onion that doesn't have a rendez-vous node. */
957 if (path->rendezvous_id == NULL)
958 return NULL;
959
960 res = tal(ctx, struct sphinx_compressed_onion);
961 res->version = packet->version;
962 res->ephemeralkey = packet->ephemeralkey;
963 res->hmac = packet->hmac;
964
965 res->routinginfo = tal_arr(res, u8, payloads_size);
966 memcpy(res->routinginfo, packet->routinginfo, payloads_size);
967
968 return res;
969}
970
971u8 *sphinx_compressed_onion_serialize(const tal_t *ctx, const struct sphinx_compressed_onion *onion)
972{

Callers 1

do_generateFunction · 0.85

Calls 1

Tested by

no test coverage detected