Skip to content

Commit 8a6f4e7

Browse files
committed
Add SCID types to ChannelDetails
We add the previously-omitted `short_channel_id`, `inbound_scid_alias`, `outbound_scid_alias` types to `ChannelDetails`.
1 parent 3f027cc commit 8a6f4e7

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed

bindings/ldk_node.udl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,9 @@ dictionary ChannelDetails {
411411
ChannelId channel_id;
412412
PublicKey counterparty_node_id;
413413
OutPoint? funding_txo;
414+
u64? short_channel_id;
415+
u64? outbound_scid_alias;
416+
u64? inbound_scid_alias;
414417
u64 channel_value_sats;
415418
u64? unspendable_punishment_reserve;
416419
UserChannelId user_channel_id;

src/types.rs

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,39 @@ pub struct ChannelDetails {
184184
/// The channel's funding transaction output, if we've negotiated the funding transaction with
185185
/// our counterparty already.
186186
pub funding_txo: Option<OutPoint>,
187+
/// The position of the funding transaction in the chain. None if the funding transaction has
188+
/// not yet been confirmed and the channel fully opened.
189+
///
190+
/// Note that if [`inbound_scid_alias`] is set, it will be used for invoices and inbound
191+
/// payments instead of this.
192+
///
193+
/// For channels with [`confirmations_required`] set to `Some(0)`, [`outbound_scid_alias`] may
194+
/// be used in place of this in outbound routes.
195+
///
196+
/// [`inbound_scid_alias`]: Self::inbound_scid_alias
197+
/// [`outbound_scid_alias`]: Self::outbound_scid_alias
198+
/// [`confirmations_required`]: Self::confirmations_required
199+
pub short_channel_id: Option<u64>,
200+
/// An optional [`short_channel_id`] alias for this channel, randomly generated by us and
201+
/// usable in place of [`short_channel_id`] to reference the channel in outbound routes when
202+
/// the channel has not yet been confirmed (as long as [`confirmations_required`] is
203+
/// `Some(0)`).
204+
///
205+
/// This will be `None` as long as the channel is not available for routing outbound payments.
206+
///
207+
/// [`short_channel_id`]: Self::short_channel_id
208+
/// [`confirmations_required`]: Self::confirmations_required
209+
pub outbound_scid_alias: Option<u64>,
210+
/// An optional [`short_channel_id`] alias for this channel, randomly generated by our
211+
/// counterparty and usable in place of [`short_channel_id`] in invoice route hints. Our
212+
/// counterparty will recognize the alias provided here in place of the [`short_channel_id`]
213+
/// when they see a payment to be routed to us.
214+
///
215+
/// Our counterparty may choose to rotate this value at any time, though will always recognize
216+
/// previous values for inbound payment forwarding.
217+
///
218+
/// [`short_channel_id`]: Self::short_channel_id
219+
pub inbound_scid_alias: Option<u64>,
187220
/// The value, in satoshis, of this channel as it appears in the funding output.
188221
pub channel_value_sats: u64,
189222
/// The value, in satoshis, that must always be held as a reserve in the channel for us. This
@@ -295,6 +328,9 @@ impl From<LdkChannelDetails> for ChannelDetails {
295328
channel_id: value.channel_id,
296329
counterparty_node_id: value.counterparty.node_id,
297330
funding_txo: value.funding_txo.map(|o| o.into_bitcoin_outpoint()),
331+
short_channel_id: value.short_channel_id,
332+
outbound_scid_alias: value.outbound_scid_alias,
333+
inbound_scid_alias: value.inbound_scid_alias,
298334
channel_value_sats: value.channel_value_satoshis,
299335
unspendable_punishment_reserve: value.unspendable_punishment_reserve,
300336
user_channel_id: UserChannelId(value.user_channel_id),

0 commit comments

Comments
 (0)