Skip to content

Commit b187d4a

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 183b337 commit b187d4a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lightning/src/offers/offer.rs

+4-1
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)