| 921 | } |
| 922 | |
| 923 | struct sphinx_compressed_onion * |
| 924 | sphinx_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 | |
| 945 | u8 *sphinx_compressed_onion_serialize(const tal_t *ctx, const struct sphinx_compressed_onion *onion) |
| 946 | { |
no test coverage detected