Skip to content

Commit e148bc9

Browse files
committed
fixup! Expose per-channel features in ChannelDetails
make outbound_htlc_minimum_msat optional this handles the conversion of the LDK type correctly & removes the possibility of panicking when we list channels
1 parent fdbd4ff commit e148bc9

1 file changed

Lines changed: 5 additions & 7 deletions

File tree

src/types.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,10 @@ pub struct ChannelCounterparty {
446446
/// payments to us through this channel.
447447
pub forwarding_info: Option<CounterpartyForwardingInfo>,
448448
/// The smallest value HTLC (in msat) the remote peer will accept, for this channel.
449-
pub outbound_htlc_minimum_msat: u64,
449+
///
450+
/// Will be `None` before we have received the `OpenChannel` or `AcceptChannel` message
451+
/// from the remote peer.
452+
pub outbound_htlc_minimum_msat: Option<u64>,
450453
/// The largest value HTLC (in msat) the remote peer currently will accept, for this channel.
451454
pub outbound_htlc_maximum_msat: Option<u64>,
452455
}
@@ -696,12 +699,7 @@ impl ChannelDetails {
696699
features: maybe_wrap(value.counterparty.features),
697700
unspendable_punishment_reserve: value.counterparty.unspendable_punishment_reserve,
698701
forwarding_info: value.counterparty.forwarding_info,
699-
// unwrap safety: This value will be `None` for objects serialized with LDK versions
700-
// prior to 0.0.115.
701-
outbound_htlc_minimum_msat: value
702-
.counterparty
703-
.outbound_htlc_minimum_msat
704-
.expect("value is set for objects serialized with LDK v0.0.107+"),
702+
outbound_htlc_minimum_msat: value.counterparty.outbound_htlc_minimum_msat,
705703
outbound_htlc_maximum_msat: value.counterparty.outbound_htlc_maximum_msat,
706704
},
707705
funding_txo: value.funding_txo.map(|o| o.into_bitcoin_outpoint()),

0 commit comments

Comments
 (0)