X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning%2Fsrc%2Frouting%2Frouter.rs;h=a83af28fcd62f9cae1ae268011ea5218d274c136;hb=31a0456c0e77cbd237edca985f591918f1fdb51d;hp=f82ddc80a11abaecf334c04a8110c9c485f696e7;hpb=3236be1d8a4547e6e65b65a8e9d38c82893d623d;p=rust-lightning diff --git a/lightning/src/routing/router.rs b/lightning/src/routing/router.rs index f82ddc80..a83af28f 100644 --- a/lightning/src/routing/router.rs +++ b/lightning/src/routing/router.rs @@ -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 {