File tree Expand file tree Collapse file tree 1 file changed +3
-6
lines changed Expand file tree Collapse file tree 1 file changed +3
-6
lines changed Original file line number Diff line number Diff line change @@ -183,11 +183,8 @@ mod inbound_payment {
183
183
let expiry_bytes = ( highest_seen_timestamp + invoice_expiry_delta_secs as u64 + 7200 ) . to_be_bytes ( ) ;
184
184
185
185
let mut metadata_bytes: [ u8 ; METADATA_LEN ] = [ 0 ; METADATA_LEN ] ;
186
- {
187
- let ( min_amt_msat_slice, expiry_slice) = metadata_bytes. split_at_mut ( AMT_MSAT_LEN ) ;
188
- min_amt_msat_slice. copy_from_slice ( & min_amt_msat_bytes) ;
189
- expiry_slice. copy_from_slice ( & expiry_bytes) ;
190
- }
186
+ metadata_bytes[ ..AMT_MSAT_LEN ] . copy_from_slice ( & min_amt_msat_bytes) ;
187
+ metadata_bytes[ AMT_MSAT_LEN ..] . copy_from_slice ( & expiry_bytes) ;
191
188
192
189
Ok ( metadata_bytes)
193
190
}
@@ -256,7 +253,7 @@ mod inbound_payment {
256
253
amt_msat_bytes. copy_from_slice ( & metadata_bytes[ ..AMT_MSAT_LEN ] ) ;
257
254
// Zero out the bits reserved to indicate the payment type.
258
255
amt_msat_bytes[ 0 ] &= 0b00011111 ;
259
- let min_amt_msat = u64:: from_be_bytes ( amt_msat_bytes. try_into ( ) . unwrap ( ) ) ;
256
+ let min_amt_msat: u64 = u64:: from_be_bytes ( amt_msat_bytes. into ( ) ) ;
260
257
let expiry = u64:: from_be_bytes ( metadata_bytes[ AMT_MSAT_LEN ..] . try_into ( ) . unwrap ( ) ) ;
261
258
262
259
// Make sure to check to check the HMAC before doing the other checks below, to mitigate timing
You can’t perform that action at this time.
0 commit comments