Skip to content

Commit 60c6992

Browse files
Offer::read: don't override DecodeError
Previously when reading an offer from bytes, if it resulted in a DecodeError then that error would be overridden by DecodeError::InvalidValue specifically. Better to return to underlying specific error.
1 parent 0613779 commit 60c6992

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lightning/src/offers/offer.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1039,7 +1039,10 @@ impl LengthReadable for Offer {
10391039
reader: &mut R,
10401040
) -> Result<Self, DecodeError> {
10411041
let bytes: WithoutLength<Vec<u8>> = LengthReadable::read_from_fixed_length_buffer(reader)?;
1042-
Self::try_from(bytes.0).map_err(|_| DecodeError::InvalidValue)
1042+
Self::try_from(bytes.0).map_err(|e| match e {
1043+
Bolt12ParseError::Decode(e) => e,
1044+
_ => DecodeError::InvalidValue,
1045+
})
10431046
}
10441047
}
10451048

0 commit comments

Comments
 (0)