Skip to content

Commit 0acd5d3

Browse files
committed
Fix an incorrect assertion in tlv stream encoding
Types must be unique and monotonically increasing (using < instead of <=)
1 parent 3a33693 commit 0acd5d3

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
@@ -55,7 +55,8 @@ macro_rules! _check_encoded_tlv_order {
5555
($last_type: expr, $type: expr, (static_value, $value: expr)) => { };
5656
($last_type: expr, $type: expr, $fieldty: tt) => {
5757
if let Some(t) = $last_type {
58-
debug_assert!(t <= $type);
58+
#[allow(unused_comparisons)] // Note that $type may be 0 making the following comparison always false
59+
(debug_assert!(t < $type))
5960
}
6061
$last_type = Some($type);
6162
};

0 commit comments

Comments
 (0)