Skip to content

Commit b8ac34e

Browse files
committed
Add helper methods needed for resource manager
- max_accepted_htlcs and max_htlc_value_in_flight_msat values in the channel are required when adding new channels in the resource manager. - get_outbound_htlcs helper will be used during restart to replay pending HTLCs.
1 parent a62d2ba commit b8ac34e

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

lightning/src/ln/channel.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4432,6 +4432,14 @@ impl<SP: SignerProvider> ChannelContext<SP> {
44324432
funding.get_htlc_maximum_msat(self.counterparty_max_htlc_value_in_flight_msat)
44334433
}
44344434

4435+
pub fn get_holder_max_htlc_value_in_flight_msat(&self) -> u64 {
4436+
self.holder_max_htlc_value_in_flight_msat
4437+
}
4438+
4439+
pub fn get_holder_max_accepted_htlcs(&self) -> u16 {
4440+
self.holder_max_accepted_htlcs
4441+
}
4442+
44354443
pub fn get_fee_proportional_millionths(&self) -> u32 {
44364444
self.config.options.forwarding_fee_proportional_millionths
44374445
}
@@ -13175,6 +13183,10 @@ where
1317513183
.chain(self.context.pending_outbound_htlcs.iter().map(|htlc| (&htlc.source, &htlc.payment_hash)))
1317613184
}
1317713185

13186+
pub fn get_outbound_htlcs(&self) -> impl Iterator<Item = (u64, &HTLCSource)> {
13187+
self.context.pending_outbound_htlcs.iter().map(|htlc| (htlc.amount_msat, &htlc.source))
13188+
}
13189+
1317813190
pub fn get_announced_htlc_max_msat(&self) -> u64 {
1317913191
return cmp::min(
1318013192
// Upper bound by capacity. We make it a bit less than full capacity to prevent attempts

0 commit comments

Comments
 (0)