Skip to content

Commit 7775356

Browse files
committed
Fix deserialization of u16 arrays
u16 arrays are used in the historical liquidity range tracker. Previously, we read them without applying the stride multiple, reading bytes repeatedly and at an offset, corrupting data as we go. This applies the correct stride multiplayer fixing the issue.
1 parent e1e3819 commit 7775356

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lightning/src/util/ser.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -596,7 +596,7 @@ impl Readable for [u16; 8] {
596596
r.read_exact(&mut buf)?;
597597
let mut res = [0u16; 8];
598598
for (idx, v) in res.iter_mut().enumerate() {
599-
*v = (buf[idx] as u16) << 8 | (buf[idx + 1] as u16)
599+
*v = (buf[idx*2] as u16) << 8 | (buf[idx*2 + 1] as u16)
600600
}
601601
Ok(res)
602602
}

0 commit comments

Comments
 (0)