mirror of
https://github.com/aljazceru/lightning.git
synced 2026-02-07 07:04:25 +01:00
common/sphinx: make TOTAL_PACKET_SIZE a macro.
This paves the way for using it on different-sized onions. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
committed by
Christian Decker
parent
dc67b60e28
commit
3776af4a35
@@ -205,7 +205,7 @@ int main(int argc, char **argv)
|
||||
} else if (streq(argv[1], "unwrap")) {
|
||||
struct privkey privkey;
|
||||
struct pubkey blinding;
|
||||
u8 onion[TOTAL_PACKET_SIZE], *dec;
|
||||
u8 onion[TOTAL_PACKET_SIZE(ROUTING_INFO_SIZE)], *dec;
|
||||
struct onionpacket op;
|
||||
struct secret ss, onion_ss;
|
||||
struct secret hmac, rho;
|
||||
|
||||
@@ -129,7 +129,7 @@ static struct route_step *decode_with_privkey(const tal_t *ctx, const u8 *onion,
|
||||
if (!hex_decode(hexprivkey, strlen(hexprivkey), &seckey, sizeof(seckey)))
|
||||
errx(1, "Invalid private key hex '%s'", hexprivkey);
|
||||
|
||||
why_bad = parse_onionpacket(onion, TOTAL_PACKET_SIZE, &packet);
|
||||
why_bad = parse_onionpacket(onion, TOTAL_PACKET_SIZE(ROUTING_INFO_SIZE), &packet);
|
||||
|
||||
if (why_bad != 0)
|
||||
errx(1, "Error parsing message: %s", onion_wire_name(why_bad));
|
||||
@@ -146,7 +146,7 @@ static struct route_step *decode_with_privkey(const tal_t *ctx, const u8 *onion,
|
||||
static void do_decode(int argc, char **argv, const u8 *assocdata)
|
||||
{
|
||||
const tal_t *ctx = talz(NULL, tal_t);
|
||||
u8 serialized[TOTAL_PACKET_SIZE];
|
||||
u8 serialized[TOTAL_PACKET_SIZE(ROUTING_INFO_SIZE)];
|
||||
struct route_step *step;
|
||||
|
||||
if (argc != 4)
|
||||
|
||||
Reference in New Issue
Block a user