sphinx: Treat compressed onions as a standalone struct

Expands the interface to play with onions a bit more. Potentially a bit
slower due to allocations, but that's a small price to pay. It also allows us
to avoid serializing a compressed onion to `u8*` if we process it right away.
This commit is contained in:
Christian Decker
2020-03-02 15:00:25 +01:00
committed by Rusty Russell
parent fd37c5b672
commit e79cda8c9a
3 changed files with 114 additions and 19 deletions

View File

@@ -294,9 +294,11 @@ static void decompress(char *hexprivkey, char *hexonion)
{
struct privkey rendezvous_key;
size_t onionlen = hex_data_size(strlen(hexonion));
u8 *compressed, *decompressed;
u8 *compressed;
struct pubkey ephkey;
struct secret shared_secret;
struct onionpacket *onion;
struct sphinx_compressed_onion *tinyonion;
if (!hex_decode(hexprivkey, strlen(hexprivkey), &rendezvous_key, sizeof(rendezvous_key)))
errx(1, "Invalid private key hex '%s'", hexprivkey);