We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b017b1c commit 7ec8676Copy full SHA for 7ec8676
lightning/src/offers/invoice.rs
@@ -1240,11 +1240,10 @@ impl TryFrom<Vec<u8>> for UnsignedBolt12Invoice {
1240
1241
let tagged_hash = TaggedHash::from_valid_tlv_stream_bytes(SIGNATURE_TAG, &bytes);
1242
1243
- let mut offset = 0;
1244
- for tlv_record in TlvStream::new(&bytes).range(0..INVOICE_TYPES.end) {
1245
- offset = tlv_record.end;
1246
- }
1247
-
+ let offset = TlvStream::new(&bytes)
+ .range(0..INVOICE_TYPES.end)
+ .last()
+ .map_or(0, |last_record| last_record.end);
1248
let experimental_bytes = bytes.split_off(offset);
1249
1250
Ok(UnsignedBolt12Invoice { bytes, experimental_bytes, contents, tagged_hash })
0 commit comments