Skip to content

Commit f19c9d1

Browse files
committed
Add more properties to ChannelConfig from LDK original struct
Adds: `counterparty_unspendable_punishment_reserve`, `counterparty_outbound_htlc_minimum_msat` `counterparty_outbound_htlc_maximum_msat` `counterparty_forwarding_info_fee_base_msat` `counterparty_forwarding_info_fee_proportional_millionths` `counterparty_forwarding_info_cltv_expiry_delta` `next_outbound_htlc_limit_msat` `next_outbound_htlc_minimum_msat` `force_close_spend_delay` `inbound_htlc_minimum_msat` `inbound_htlc_maximum_msat` `config`
1 parent db1b7dc commit f19c9d1

File tree

2 files changed

+93
-1
lines changed

2 files changed

+93
-1
lines changed

bindings/ldk_node.udl

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,18 @@ dictionary ChannelDetails {
196196
boolean is_usable;
197197
boolean is_public;
198198
u16? cltv_expiry_delta;
199+
u64 counterparty_unspendable_punishment_reserve;
200+
u64? counterparty_outbound_htlc_minimum_msat;
201+
u64? counterparty_outbound_htlc_maximum_msat;
202+
u32? counterparty_forwarding_info_fee_base_msat;
203+
u32? counterparty_forwarding_info_fee_proportional_millionths;
204+
u64? counterparty_forwarding_info_cltv_expiry_delta;
205+
u64 next_outbound_htlc_limit_msat;
206+
u64 next_outbound_htlc_minimum_msat;
207+
u16? force_close_spend_delay;
208+
u64? inbound_htlc_minimum_msat;
209+
u64? inbound_htlc_maximum_msat;
210+
ChannelConfig? config;
199211
};
200212

201213
dictionary PeerDetails {

src/types.rs

Lines changed: 81 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ impl Readable for UserChannelId {
152152
/// Details of a channel as returned by [`Node::list_channels`].
153153
///
154154
/// [`Node::list_channels`]: crate::Node::list_channels
155-
#[derive(Debug, Clone, PartialEq, Eq)]
155+
#[derive(Debug, Clone)]
156156
pub struct ChannelDetails {
157157
/// The channel ID (prior to funding transaction generation, this is a random 32-byte
158158
/// identifier, afterwards this is the transaction ID of the funding transaction XOR the
@@ -226,6 +226,60 @@ pub struct ChannelDetails {
226226
/// The difference in the CLTV value between incoming HTLCs and an outbound HTLC forwarded over
227227
/// the channel.
228228
pub cltv_expiry_delta: Option<u16>,
229+
/// The value, in satoshis, that must always be held in the channel for our counterparty. This
230+
/// value ensures that if our counterparty broadcasts a revoked state, we can punish them by
231+
/// claiming at least this value on chain.
232+
///
233+
/// This value is not included in [`inbound_capacity_msat`] as it can never be spent.
234+
///
235+
/// [`inbound_capacity_msat`]: ChannelDetails::inbound_capacity_msat
236+
pub counterparty_unspendable_punishment_reserve: u64,
237+
/// The smallest value HTLC (in msat) the remote peer will accept, for this channel. This field
238+
/// is only `None` before we have received either the `OpenChannel` or `AcceptChannel` message
239+
/// from the remote peer, or for `ChannelCounterparty` objects serialized prior to LDK 0.0.107.
240+
pub counterparty_outbound_htlc_minimum_msat: Option<u64>,
241+
/// The largest value HTLC (in msat) the remote peer currently will accept, for this channel.
242+
pub counterparty_outbound_htlc_maximum_msat: Option<u64>,
243+
/// Base routing fee in millisatoshis.
244+
pub counterparty_forwarding_info_fee_base_msat: Option<u32>,
245+
/// Amount in millionths of a satoshi the channel will charge per transferred satoshi.
246+
pub counterparty_forwarding_info_fee_proportional_millionths: Option<u32>,
247+
/// The minimum difference in cltv_expiry between an ingoing HTLC and its outgoing counterpart,
248+
/// such that the outgoing HTLC is forwardable to this counterparty. See `msgs::ChannelUpdate`'s
249+
/// `cltv_expiry_delta` for more details.
250+
pub counterparty_forwarding_info_cltv_expiry_delta: Option<u16>,
251+
/// The available outbound capacity for sending a single HTLC to the remote peer. This is
252+
/// similar to [`ChannelDetails::outbound_capacity_msat`] but it may be further restricted by
253+
/// the current state and per-HTLC limit(s). This is intended for use when routing, allowing us
254+
/// to use a limit as close as possible to the HTLC limit we can currently send.
255+
///
256+
/// See also [`ChannelDetails::next_outbound_htlc_minimum_msat`],
257+
/// [`ChannelDetails::balance_msat`], and [`ChannelDetails::outbound_capacity_msat`].
258+
pub next_outbound_htlc_limit_msat: u64,
259+
/// The minimum value for sending a single HTLC to the remote peer. This is the equivalent of
260+
/// [`ChannelDetails::next_outbound_htlc_limit_msat`] but represents a lower-bound, rather than
261+
/// an upper-bound. This is intended for use when routing, allowing us to ensure we pick a
262+
/// route which is valid.
263+
pub next_outbound_htlc_minimum_msat: u64,
264+
/// The number of blocks (after our commitment transaction confirms) that we will need to wait
265+
/// until we can claim our funds after we force-close the channel. During this time our
266+
/// counterparty is allowed to punish us if we broadcasted a stale state. If our counterparty
267+
/// force-closes the channel and broadcasts a commitment transaction we do not have to wait any
268+
/// time to claim our non-HTLC-encumbered funds.
269+
///
270+
/// This value will be `None` for outbound channels until the counterparty accepts the channel.
271+
pub force_close_spend_delay: Option<u16>,
272+
/// The stage of the channel's shutdown.
273+
/// `None` for `ChannelDetails` serialized on LDK versions prior to 0.0.116.
274+
/// The smallest value HTLC (in msat) we will accept, for this channel. This field
275+
/// is only `None` for `ChannelDetails` objects serialized prior to LDK 0.0.107
276+
pub inbound_htlc_minimum_msat: Option<u64>,
277+
/// The largest value HTLC (in msat) we currently will accept, for this channel.
278+
pub inbound_htlc_maximum_msat: Option<u64>,
279+
/// Set of configurable parameters that affect channel operation.
280+
///
281+
/// This field is only `None` for `ChannelDetails` objects serialized prior to LDK 0.0.109.
282+
pub config: Option<ChannelConfig>,
229283
}
230284

231285
impl From<LdkChannelDetails> for ChannelDetails {
@@ -248,6 +302,32 @@ impl From<LdkChannelDetails> for ChannelDetails {
248302
is_usable: value.is_usable,
249303
is_public: value.is_public,
250304
cltv_expiry_delta: value.config.and_then(|c| Some(c.cltv_expiry_delta)),
305+
counterparty_unspendable_punishment_reserve: value
306+
.counterparty
307+
.unspendable_punishment_reserve,
308+
counterparty_outbound_htlc_minimum_msat: value.counterparty.outbound_htlc_minimum_msat,
309+
counterparty_outbound_htlc_maximum_msat: value.counterparty.outbound_htlc_maximum_msat,
310+
counterparty_forwarding_info_fee_base_msat: value
311+
.counterparty
312+
.forwarding_info
313+
.as_ref()
314+
.and_then(|f| Some(f.fee_base_msat)),
315+
counterparty_forwarding_info_fee_proportional_millionths: value
316+
.counterparty
317+
.forwarding_info
318+
.as_ref()
319+
.and_then(|f| Some(f.fee_proportional_millionths)),
320+
counterparty_forwarding_info_cltv_expiry_delta: value
321+
.counterparty
322+
.forwarding_info
323+
.as_ref()
324+
.and_then(|f| Some(f.cltv_expiry_delta)),
325+
next_outbound_htlc_limit_msat: value.next_outbound_htlc_limit_msat,
326+
next_outbound_htlc_minimum_msat: value.next_outbound_htlc_minimum_msat,
327+
force_close_spend_delay: value.force_close_spend_delay,
328+
inbound_htlc_minimum_msat: value.inbound_htlc_minimum_msat,
329+
inbound_htlc_maximum_msat: value.inbound_htlc_maximum_msat,
330+
config: value.config.and_then(|f| Some(f.into())),
251331
}
252332
}
253333
}

0 commit comments

Comments
 (0)