@@ -740,25 +740,22 @@ where
740
740
}
741
741
}
742
742
743
- /// Data structure used to track information about inflight HTLCs.
744
- pub struct InFlightHtlcs {
745
- /// A map with liquidity value (in msat) keyed by a short channel id and the direction the HTLC
746
- /// is traveling in. The direction boolean is determined by checking if the HTLC source's public
747
- /// key is less than its destination. See [`InFlightHtlcs::used_liquidity_msat`] for more
748
- /// details.
749
- pub map : HashMap < ( u64 , bool ) , u64 >
750
- }
743
+ /// A map with liquidity value (in msat) keyed by a short channel id and the direction the HTLC
744
+ /// is traveling in. The direction boolean is determined by checking if the HTLC source's public
745
+ /// key is less than its destination. See [`InFlightHtlcs::used_liquidity_msat`] for more
746
+ /// details.
747
+ pub struct InFlightHtlcs ( HashMap < ( u64 , bool ) , u64 > ) ;
751
748
752
749
impl InFlightHtlcs {
753
750
/// Creates a new instance with an optional map of liquidity information.
754
- pub fn new ( map : Option < HashMap < ( u64 , bool ) , u64 > > ) -> Self {
755
- InFlightHtlcs { map : map . unwrap_or ( HashMap :: new ( ) ) }
751
+ pub fn new ( used_liquidity_msat : Option < HashMap < ( u64 , bool ) , u64 > > ) -> Self {
752
+ InFlightHtlcs ( used_liquidity_msat . unwrap_or ( HashMap :: new ( ) ) )
756
753
}
757
754
758
755
/// Returns liquidity in msat given the public key of the HTLC source, target, and short channel
759
756
/// id.
760
757
pub fn used_liquidity_msat ( & self , source : & NodeId , target : & NodeId , channel_scid : u64 ) -> Option < & u64 > {
761
- self . map . get ( & ( channel_scid, source < target) )
758
+ self . 0 . get ( & ( channel_scid, source < target) )
762
759
}
763
760
}
764
761
0 commit comments