Skip to content

Commit 4988b76

Browse files
f Fix Add htcl min/max to CounterpartyForwardingInfo
1 parent 5942f78 commit 4988b76

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

lightning/src/ln/channel.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4310,6 +4310,11 @@ impl<Signer: Sign> Channel<Signer> {
43104310
self.counterparty_htlc_minimum_msat
43114311
}
43124312

4313+
/// Allowed in any state (including after shutdown), but will return none before TheirInitSent
4314+
pub fn get_counterparty_htlc_maximum_msat(&self) -> Option<u64> {
4315+
self.get_htlc_maximum_msat(self.counterparty_max_htlc_value_in_flight_msat)
4316+
}
4317+
43134318
fn get_htlc_maximum_msat(&self, party_max_htlc_value_in_flight_msat: u64) -> Option<u64> {
43144319
self.counterparty_selected_channel_reserve_satoshis.map(|counterparty_reserve| {
43154320
let holder_reserve = self.holder_selected_channel_reserve_satoshis;
@@ -5385,16 +5390,12 @@ impl<Signer: Sign> Channel<Signer> {
53855390
if msg.contents.htlc_minimum_msat >= self.channel_value_satoshis * 1000 {
53865391
return Err(ChannelError::Close("Minimum htlc value is greater than channel value".to_string()));
53875392
}
5388-
let outbound_htlc_maximum_msat = match msg.contents.htlc_maximum_msat {
5389-
OptionalField::Present(htcl_max) => Some(htcl_max),
5390-
OptionalField::Absent => None
5391-
};
53925393
self.counterparty_forwarding_info = Some(CounterpartyForwardingInfo {
53935394
fee_base_msat: msg.contents.fee_base_msat,
53945395
fee_proportional_millionths: msg.contents.fee_proportional_millionths,
53955396
cltv_expiry_delta: msg.contents.cltv_expiry_delta,
5396-
outbound_htlc_minimum_msat: Some(msg.contents.htlc_minimum_msat),
5397-
outbound_htlc_maximum_msat,
5397+
outbound_htlc_minimum_msat: Some(self.get_counterparty_htlc_minimum_msat()),
5398+
outbound_htlc_maximum_msat: self.get_counterparty_htlc_maximum_msat(),
53985399
});
53995400

54005401
Ok(())

lightning/src/ln/channelmanager.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1160,7 +1160,7 @@ pub struct CounterpartyForwardingInfo {
11601160
/// `cltv_expiry_delta` for more details.
11611161
pub cltv_expiry_delta: u16,
11621162
/// The smallest value HTLC (in msat) the remote peer will accept, for this channel. This field
1163-
/// is only None for `CounterpartyForwardingInfo` objects serialized prior to LDK 0.0.107
1163+
/// is only `None` for `CounterpartyForwardingInfo` objects serialized prior to LDK 0.0.107
11641164
pub outbound_htlc_minimum_msat: Option<u64>,
11651165
/// The largest value HTLC (in msat) the remote peer currently will accept, for this channel.
11661166
pub outbound_htlc_maximum_msat: Option<u64>,

0 commit comments

Comments
 (0)