Skip to content

Commit 5010aca

Browse files
committed
[invoice] Ignore InvalidLength fields
BOLT 11 states that a reader "MUST skip over...`p`, `h`, `s` or `n` fields that do NOT have data_lengths of 52, 52, 52 or 53, respectively." Here we do so by simply ignoring any invalid-length field.
1 parent 52df102 commit 5010aca

File tree

1 file changed

+1
-1
lines changed
  • lightning-invoice/src

1 file changed

+1
-1
lines changed

lightning-invoice/src/de.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ fn parse_tagged_parts(data: &[u5]) -> Result<Vec<RawTaggedField>, ParseError> {
419419
Ok(field) => {
420420
parts.push(RawTaggedField::KnownSemantics(field))
421421
},
422-
Err(ParseError::Skip) => {
422+
Err(ParseError::Skip)|Err(ParseError::Bech32Error(bech32::Error::InvalidLength)) => {
423423
parts.push(RawTaggedField::UnknownSemantics(field.into()))
424424
},
425425
Err(e) => {return Err(e)}

0 commit comments

Comments
 (0)