From: Omer Yacine Date: Wed, 2 Nov 2022 15:32:47 +0000 (+0200) Subject: Fix an incorrect assertion in tlv stream encoding X-Git-Tag: v0.0.114-beta~66^2 X-Git-Url: http://git.bitcoin.ninja/?a=commitdiff_plain;h=0acd5d3e46b307f5a34bc8ef5286bf1b5a58a37e;p=rust-lightning Fix an incorrect assertion in tlv stream encoding Types must be unique and monotonically increasing (using < instead of <=) --- diff --git a/lightning/src/util/ser_macros.rs b/lightning/src/util/ser_macros.rs index 2ed3683f4..d137b0f67 100644 --- a/lightning/src/util/ser_macros.rs +++ b/lightning/src/util/ser_macros.rs @@ -55,7 +55,8 @@ macro_rules! _check_encoded_tlv_order { ($last_type: expr, $type: expr, (static_value, $value: expr)) => { }; ($last_type: expr, $type: expr, $fieldty: tt) => { if let Some(t) = $last_type { - debug_assert!(t <= $type); + #[allow(unused_comparisons)] // Note that $type may be 0 making the following comparison always false + (debug_assert!(t < $type)) } $last_type = Some($type); };