Skip to content

Commit e15c9dd

Browse files
committed
Implement Readable for LengthReadable
Inbound Trampoline entrypoint packets will contain inner onions, which only implement LengthReadable. Until now, we never had to decode LengthReadable-only structs in TLV streams, so this issue never surfaced before, but going forward, this will allow us to parse inbound Trampoline data.
1 parent 9ae25a8 commit e15c9dd

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

lightning/src/util/ser.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,13 @@ where
371371
fn read_from_fixed_length_buffer<R: LengthRead>(reader: &mut R) -> Result<Self, DecodeError>;
372372
}
373373

374+
impl<T: Readable> LengthReadable for T {
375+
#[inline]
376+
fn read_from_fixed_length_buffer<R: LengthRead>(reader: &mut R) -> Result<T, DecodeError> {
377+
Readable::read(reader)
378+
}
379+
}
380+
374381
/// A trait that various LDK types implement allowing them to (maybe) be read in from a [`Read`].
375382
///
376383
/// This is not exported to bindings users as we only export serialization to/from byte arrays instead

0 commit comments

Comments
 (0)