From f371b6df20365000f4d776a8c95e1cd649129b39 Mon Sep 17 00:00:00 2001 From: sstone Date: Wed, 12 Jul 2017 18:34:31 +0200 Subject: [PATCH] sphinx: fix payload amount encoding it was changed to 64 bits --- lightningd/sphinx.c | 8 ++++---- lightningd/sphinx.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lightningd/sphinx.c b/lightningd/sphinx.c index d04f2ca30..13845fd3c 100644 --- a/lightningd/sphinx.c +++ b/lightningd/sphinx.c @@ -336,9 +336,9 @@ static void serialize_hop_data(tal_t *ctx, u8 *dst, const struct hop_data *data) u8 *buf = tal_arr(ctx, u8, 0); towire_u8(&buf, data->realm); towire_short_channel_id(&buf, &data->channel_id); - towire_u32(&buf, data->amt_forward); + towire_u64(&buf, data->amt_forward); towire_u32(&buf, data->outgoing_cltv); - towire_pad(&buf, 16); + towire_pad(&buf, 12); towire(&buf, data->hmac, SECURITY_PARAMETER); memcpy(dst, buf, tal_len(buf)); tal_free(buf); @@ -350,9 +350,9 @@ static void deserialize_hop_data(struct hop_data *data, const u8 *src) size_t max = HOP_DATA_SIZE; data->realm = fromwire_u8(&cursor, &max); fromwire_short_channel_id(&cursor, &max, &data->channel_id); - data->amt_forward = fromwire_u32(&cursor, &max); + data->amt_forward = fromwire_u64(&cursor, &max); data->outgoing_cltv = fromwire_u32(&cursor, &max); - fromwire_pad(&cursor, &max, 16); + fromwire_pad(&cursor, &max, 12); fromwire(&cursor, &max, &data->hmac, SECURITY_PARAMETER); } diff --git a/lightningd/sphinx.h b/lightningd/sphinx.h index f3ea734d6..f82ff368b 100644 --- a/lightningd/sphinx.h +++ b/lightningd/sphinx.h @@ -66,7 +66,7 @@ enum route_next_case { struct hop_data { u8 realm; struct short_channel_id channel_id; - u32 amt_forward; + u64 amt_forward; u32 outgoing_cltv; /* Padding omitted, will be zeroed */ u8 hmac[SECURITY_PARAMETER];