Skip to content

Commit 541c943

Browse files
committed
Fix the correctness of an assertion in the tlv stream encoding
Types must be unique and monotonically increasing (using < instead of <=)
1 parent 59b3c4f commit 541c943

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lightning/src/util/ser_macros.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ macro_rules! encode_tlv_stream {
6161
let mut last_seen: Option<u64> = None;
6262
$(
6363
if let Some(t) = last_seen {
64-
debug_assert!(t <= $type);
64+
#[allow(unused_comparisons)] // Note that $type may be 0 making the following comparison always false
65+
(debug_assert!(t < $type))
6566
}
6667
last_seen = Some($type);
6768
)*

0 commit comments

Comments
 (0)