mirror of
https://github.com/lightningdevkit/rust-lightning.git
synced 2025-02-25 15:20:24 +01:00
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
This commit is contained in:
parent
f6a93826e2
commit
b9274e5fcc
1 changed files with 9 additions and 0 deletions
|
@ -218,6 +218,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> {
|
||||
|
|
Loading…
Add table
Reference in a new issue