Merge pull request #2400 from TheBlueMatt/2023-07-kill-vec_type
[rust-lightning] / lightning / src / routing / router.rs
index 8c00df99a7eed96cbb3fb4633b2622c53532dfa6..d3539579c50ae16d8a8d92eb806af6364243327d 100644 (file)
@@ -204,6 +204,15 @@ impl InFlightHtlcs {
                }
        }
 
+       /// Adds a known HTLC given the public key of the HTLC source, target, and short channel
+       /// id.
+       pub fn add_inflight_htlc(&mut self, source: &NodeId, target: &NodeId, channel_scid: u64, used_msat: u64){
+               self.0
+                       .entry((channel_scid, source < target))
+                       .and_modify(|used_liquidity_msat| *used_liquidity_msat += used_msat)
+                       .or_insert(used_msat);
+       }
+
        /// 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> {
@@ -2686,7 +2695,8 @@ mod tests {
                        inbound_htlc_minimum_msat: None,
                        inbound_htlc_maximum_msat: None,
                        config: None,
-                       feerate_sat_per_1000_weight: None
+                       feerate_sat_per_1000_weight: None,
+                       channel_shutdown_state: Some(channelmanager::ChannelShutdownState::NotShuttingDown),
                }
        }
 
@@ -6757,6 +6767,7 @@ pub(crate) mod bench_utils {
                        inbound_htlc_maximum_msat: None,
                        config: None,
                        feerate_sat_per_1000_weight: None,
+                       channel_shutdown_state: Some(channelmanager::ChannelShutdownState::NotShuttingDown),
                }
        }