Skip to content

Commit 00556af

Browse files
f cleanups
1 parent 52a31d8 commit 00556af

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

lightning/src/ln/channelmanager.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -183,11 +183,8 @@ mod inbound_payment {
183183
let expiry_bytes = (highest_seen_timestamp + invoice_expiry_delta_secs as u64 + 7200).to_be_bytes();
184184

185185
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);
191188

192189
Ok(metadata_bytes)
193190
}
@@ -256,7 +253,7 @@ mod inbound_payment {
256253
amt_msat_bytes.copy_from_slice(&metadata_bytes[..AMT_MSAT_LEN]);
257254
// Zero out the bits reserved to indicate the payment type.
258255
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());
260257
let expiry = u64::from_be_bytes(metadata_bytes[AMT_MSAT_LEN..].try_into().unwrap());
261258

262259
// Make sure to check to check the HMAC before doing the other checks below, to mitigate timing

0 commit comments

Comments
 (0)