Skip to content

Commit b194c1d

Browse files
committed
Impl Writeable and Readable for InFlightHtlcs
1 parent b886529 commit b194c1d

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

lightning-invoice/src/payment.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -752,6 +752,19 @@ impl InFlightHtlcs {
752752
}
753753
}
754754

755+
#[cfg(not(feature = "no-std"))]
756+
impl lightning::util::ser::Writeable for InFlightHtlcs {
757+
fn write<W: lightning::util::ser::Writer>(&self, writer: &mut W) -> Result<(), std::io::Error> { self.0.write(writer) }
758+
}
759+
760+
#[cfg(not(feature = "no-std"))]
761+
impl lightning::util::ser::Readable for InFlightHtlcs {
762+
fn read<R: lightning::io::Read>(reader: &mut R) -> Result<Self, lightning::ln::msgs::DecodeError> {
763+
let infight_map: HashMap<(u64, bool), u64> = lightning::util::ser::Readable::read(reader)?;
764+
Ok(Self(infight_map))
765+
}
766+
}
767+
755768
#[cfg(test)]
756769
mod tests {
757770
use super::*;

0 commit comments

Comments
 (0)