Browse Source

sphinx: fix payload amount encoding

it was changed to 64 bits
ppa-0.6.1
sstone 8 years ago
committed by Christian Decker
parent
commit
f371b6df20
  1. 8
      lightningd/sphinx.c
  2. 2
      lightningd/sphinx.h

8
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);
}

2
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];

Loading…
Cancel
Save