-/// A map with liquidity value (in msat) keyed by a short channel id and the direction the HTLC
-/// is traveling in. The direction boolean is determined by checking if the HTLC source's public
-/// key is less than its destination. See [`InFlightHtlcs::used_liquidity_msat`] for more
-/// details.
-pub struct InFlightHtlcs(HashMap<(u64, bool), u64>);
-
-impl InFlightHtlcs {
- /// Returns liquidity in msat given the public key of the HTLC source, target, and short channel
- /// id.
- pub fn used_liquidity_msat(&self, source: &NodeId, target: &NodeId, channel_scid: u64) -> Option<u64> {
- self.0.get(&(channel_scid, source < target)).map(|v| *v)
- }
-}
-
-impl Writeable for InFlightHtlcs {
- fn write<W: lightning::util::ser::Writer>(&self, writer: &mut W) -> Result<(), io::Error> { self.0.write(writer) }
-}
-
-impl lightning::util::ser::Readable for InFlightHtlcs {
- fn read<R: io::Read>(reader: &mut R) -> Result<Self, lightning::ln::msgs::DecodeError> {
- let infight_map: HashMap<(u64, bool), u64> = lightning::util::ser::Readable::read(reader)?;
- Ok(Self(infight_map))
- }
-}
-