mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 07:04:22 +01:00
sphinx: Switch to big-endian number encoding
See https://github.com/lightningnetwork/lightning-rfc/pull/619 and https://github.com/lightningnetwork/lightning-rfc/pull/619 for discussion. Signed-off-by: Christian Decker <decker.christian@gmail.com>
This commit is contained in:
committed by
Rusty Russell
parent
c752c3318d
commit
78c7edb889
@@ -454,7 +454,7 @@ static bool sphinx_write_frame(u8 *dest, const struct sphinx_hop *hop)
|
||||
if (hop->type == SPHINX_V0_PAYLOAD)
|
||||
dest[pos++] = 0x00;
|
||||
else
|
||||
pos += varint_put(dest+pos, raw_size);
|
||||
pos += bigsize_put(dest+pos, raw_size);
|
||||
|
||||
memcpy(dest + pos, hop->payload, raw_size);
|
||||
pos += raw_size;
|
||||
@@ -618,7 +618,7 @@ struct route_step *process_onionpacket(
|
||||
} else {
|
||||
/* In addition to the raw payload we need to also shift the
|
||||
* length encoding itself and the HMAC away. */
|
||||
vsize = varint_get(paddedheader, 3, &shift_size);
|
||||
vsize = bigsize_get(paddedheader, 3, &shift_size);
|
||||
shift_size += vsize + HMAC_SIZE;
|
||||
|
||||
/* If we get an unreasonable shift size we must return an error. */
|
||||
|
||||
Reference in New Issue
Block a user