@@ -179,18 +179,15 @@ fn construct_metadata_bytes(min_value_msat: Option<u64>, payment_type: Method,
179
179
let expiry_timestamp = highest_seen_timestamp + invoice_expiry_delta_secs as u64 + 7200 ;
180
180
let mut expiry_bytes = expiry_timestamp. to_be_bytes ( ) ;
181
181
182
- if min_final_cltv_expiry_delta. is_some ( ) {
183
- if {
184
- // `min_value_msat` should fit in (64 bits - 3 payment type bits =) 61 bits as an unsigned integer.
185
- // This should leave us with a maximum value greater than the 21M BTC supply cap anyway.
186
- min_value_msat. is_some ( ) && min_value_msat. unwrap ( ) > ( ( 1u64 << 61 ) - 1 ) ||
187
- // `expiry_timestamp` should fit in (64 bits - 2 delta bytes =) 48 bits as an unsigned integer.
188
- // Bitcoin's block header timestamps are actually `u32`s, so we're technically already limited to
189
- // the much smaller maximum timestamp of `u32::MAX` for now, but we check the u64 `expiry_timestamp`
190
- // for future-proofing.
191
- expiry_timestamp > ( ( 1u64 << 48 ) - 1 )
192
- } { return Err ( ( ) ) ; }
193
- }
182
+ // `min_value_msat` should fit in (64 bits - 3 payment type bits =) 61 bits as an unsigned integer.
183
+ // This should leave us with a maximum value greater than the 21M BTC supply cap anyway.
184
+ if min_value_msat. is_some ( ) && min_value_msat. unwrap ( ) > ( ( 1u64 << 61 ) - 1 ) { return Err ( ( ) ) ; }
185
+
186
+ // `expiry_timestamp` should fit in (64 bits - 2 delta bytes =) 48 bits as an unsigned integer.
187
+ // Bitcoin's block header timestamps are actually `u32`s, so we're technically already limited to
188
+ // the much smaller maximum timestamp of `u32::MAX` for now, but we check the u64 `expiry_timestamp`
189
+ // for future-proofing.
190
+ if min_final_cltv_expiry_delta. is_some ( ) && expiry_timestamp > ( ( 1u64 << 48 ) - 1 ) { return Err ( ( ) ) ; }
194
191
195
192
if let Some ( min_final_cltv_expiry_delta) = min_final_cltv_expiry_delta {
196
193
let bytes = min_final_cltv_expiry_delta. to_be_bytes ( ) ;
0 commit comments