Skip to content

Commit c13b6d8

Browse files
committed
Implement Readable for Offer
When storing `Offer`s, it's useful for them to implement LDK's deserialization trait.
1 parent bd16a1e commit c13b6d8

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

lightning/src/offers/offer.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -966,6 +966,13 @@ impl OfferContents {
966966
}
967967
}
968968

969+
impl Readable for Offer {
970+
fn read<R: io::Read>(reader: &mut R) -> Result<Self, DecodeError> {
971+
let bytes: WithoutLength<Vec<u8>> = Readable::read(reader)?;
972+
Self::try_from(bytes.0).map_err(|_| DecodeError::InvalidValue)
973+
}
974+
}
975+
969976
impl Writeable for Offer {
970977
fn write<W: Writer>(&self, writer: &mut W) -> Result<(), io::Error> {
971978
WithoutLength(&self.bytes).write(writer)

0 commit comments

Comments
 (0)