Skip to content

Commit b9274e5

Browse files
author
ff
committed
Added a function which adds inflight HTLCs to InFlightHtlcs-struct,
which is used by router One would use that function if he would get data from for example c-lightning lightning.readthedocs.io/lightning-listhtlcs.7.html and would like to use that with ldk's router
1 parent f6a9382 commit b9274e5

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

lightning/src/routing/router.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,15 @@ impl InFlightHtlcs {
218218
}
219219
}
220220

221+
/// Adds a known HTLC given the public key of the HTLC source, target, and short channel
222+
/// id.
223+
pub fn add_inflight_htlc(&mut self, source: &NodeId, target: &NodeId, channel_scid: u64, used_msat: u64){
224+
self.0
225+
.entry((channel_scid, source < target))
226+
.and_modify(|used_liquidity_msat| *used_liquidity_msat += used_msat)
227+
.or_insert(used_msat);
228+
}
229+
221230
/// Returns liquidity in msat given the public key of the HTLC source, target, and short channel
222231
/// id.
223232
pub fn used_liquidity_msat(&self, source: &NodeId, target: &NodeId, channel_scid: u64) -> Option<u64> {

0 commit comments

Comments
 (0)