Skip to content

Commit 0800d68

Browse files
f construct_payment_secret cleanups
1 parent 704e175 commit 0800d68

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

lightning/src/ln/channelmanager.rs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -189,16 +189,14 @@ mod inbound_payment {
189189
Ok(metadata_bytes)
190190
}
191191

192-
fn construct_payment_secret(iv_bytes: &[u8; IV_LEN], metadata_bytes: &[u8], metadata_key: &[u8; METADATA_KEY_LEN]) -> PaymentSecret {
192+
fn construct_payment_secret(iv_bytes: &[u8; IV_LEN], metadata_bytes: &[u8; METADATA_LEN], metadata_key: &[u8; METADATA_KEY_LEN]) -> PaymentSecret {
193193
let mut payment_secret_bytes: [u8; 32] = [0; 32];
194-
{
195-
let (iv_slice, encrypted_metadata_slice) = payment_secret_bytes.split_at_mut(IV_LEN);
196-
iv_slice.copy_from_slice(iv_bytes);
194+
let (iv_slice, encrypted_metadata_slice) = payment_secret_bytes.split_at_mut(IV_LEN);
195+
iv_slice.copy_from_slice(iv_bytes);
197196

198-
let chacha_block = ChaCha20::get_single_block(metadata_key, iv_bytes);
199-
for i in 0..METADATA_LEN {
200-
encrypted_metadata_slice[i] = chacha_block[i] ^ metadata_bytes[i];
201-
}
197+
let chacha_block = ChaCha20::get_single_block(metadata_key, iv_bytes);
198+
for i in 0..METADATA_LEN {
199+
encrypted_metadata_slice[i] = chacha_block[i] ^ metadata_bytes[i];
202200
}
203201
PaymentSecret(payment_secret_bytes)
204202
}

0 commit comments

Comments
 (0)