Skip to content

Commit 0d3adb8

Browse files
authored
Merge pull request #2042 from ffaex/add_fn
added fn_add_htlc
2 parents b66e3c5 + b9274e5 commit 0d3adb8

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
@@ -204,6 +204,15 @@ impl InFlightHtlcs {
204204
}
205205
}
206206

207+
/// Adds a known HTLC given the public key of the HTLC source, target, and short channel
208+
/// id.
209+
pub fn add_inflight_htlc(&mut self, source: &NodeId, target: &NodeId, channel_scid: u64, used_msat: u64){
210+
self.0
211+
.entry((channel_scid, source < target))
212+
.and_modify(|used_liquidity_msat| *used_liquidity_msat += used_msat)
213+
.or_insert(used_msat);
214+
}
215+
207216
/// Returns liquidity in msat given the public key of the HTLC source, target, and short channel
208217
/// id.
209218
pub fn used_liquidity_msat(&self, source: &NodeId, target: &NodeId, channel_scid: u64) -> Option<u64> {

0 commit comments

Comments
 (0)