Skip to content

Commit a9786b1

Browse files
committed
Minor review fixes
1 parent ce978cc commit a9786b1

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

lightning-invoice/src/de.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,8 @@ impl FromBase32 for PaymentSecret {
7171
"PaymentSecret::from_base32()".into(),
7272
));
7373
}
74-
let data_bytes = Vec::<u8>::from_base32(field_data)?;
75-
let mut payment_secret = [0; 32];
76-
payment_secret.copy_from_slice(&data_bytes);
77-
Ok(PaymentSecret(payment_secret))
74+
let data_bytes = <[u8; 32]>::from_base32(field_data)?;
75+
Ok(PaymentSecret(data_bytes))
7876
}
7977
}
8078

lightning-invoice/src/ser.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,8 @@ impl Base32Iterable for Bolt11InvoiceFeatures {
128128

129129
impl Base32Len for Bolt11InvoiceFeatures {
130130
fn base32_len(&self) -> usize {
131-
// Here we actually do the conversion
132-
self.fe_iter().collect::<Vec<Fe32>>().len()
131+
// Here we perform the real conversion, due to trimming it's hard to estimate
132+
self.fe_iter().count()
133133
}
134134
}
135135

0 commit comments

Comments
 (0)