Skip to content

Commit 70e6563

Browse files
committed
Minor optimization (replace data_part_ascii_no_checksum)
1 parent 05dd6a1 commit 70e6563

File tree

1 file changed

+2
-4
lines changed
  • lightning-invoice/src

1 file changed

+2
-4
lines changed

lightning-invoice/src/de.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -364,10 +364,8 @@ impl FromStr for SignedRawBolt11Invoice {
364364
fn from_str(s: &str) -> Result<Self, Self::Err> {
365365
let parsed = CheckedHrpstring::new::<Bech32>(s)?;
366366
let hrp = parsed.hrp();
367-
// Access original non-packed 32 byte values (as ascii + conversion)
368-
let data: Vec<_> = parsed.data_part_ascii_no_checksum().iter()
369-
.map(|ch| Fe32::from_char(char::from(*ch)).expect("value should be < 32"))
370-
.collect();
367+
// Access original non-packed 32 byte values (as Fe32s)
368+
let data: Vec<_> = parsed.fe32_iter::<alloc::boxed::Box<dyn Iterator<Item = u8>>>().collect();
371369

372370
const SIGNATURE_LEN5: usize = 104; // 32-bit values, 65 bytes
373371
if data.len() < SIGNATURE_LEN5 {

0 commit comments

Comments
 (0)