mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-17 19:03:42 +01:00
gossipd: fix calculation of crc32 of update.
Currently EXPERIMENTAL_FEATURES only, fortunately. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
5b5d70d640
commit
d1a1592cc8
@ -988,11 +988,12 @@ static u32 crc32_of_update(const u8 *channel_update)
|
||||
* * [`u32`:`timestamp`]
|
||||
*...
|
||||
*/
|
||||
/* Note: 2 bytes for `type` field */
|
||||
/* We already checked it's valid before accepting */
|
||||
assert(tal_count(channel_update) > 64 + 32 + 8 + 4);
|
||||
sum = crc32c(0, channel_update + 64, 32 + 8);
|
||||
sum = crc32c(sum, channel_update + 64 + 32 + 8 + 4,
|
||||
tal_count(channel_update) - (64 + 32 + 8 + 4));
|
||||
assert(tal_count(channel_update) > 2 + 64 + 32 + 8 + 4);
|
||||
sum = crc32c(0, channel_update + 2 + 64, 32 + 8);
|
||||
sum = crc32c(sum, channel_update + 2 + 64 + 32 + 8 + 4,
|
||||
tal_count(channel_update) - (64 + 2 + 32 + 8 + 4));
|
||||
return sum;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user