@@ -968,6 +968,13 @@ pub struct ChannelDetails {
968
968
/// [`inbound_scid_alias`]: Self::inbound_scid_alias
969
969
/// [`get_inbound_payment_scid`]: Self::get_inbound_payment_scid
970
970
pub short_channel_id : Option < u64 > ,
971
+ /// An optional [`short_channel_id`] alias for this channel, randomly generated by us and
972
+ /// usable in place of [`short_channel_id`] to reference the channel in outbound routes even if
973
+ /// the channel has not yet been confirmed (as long as [`confirmations_required`] is
974
+ /// `Some(0)`).
975
+ ///
976
+ /// This will be `None` as long as the channel is not available for routing outbound payments.
977
+ pub outbound_scid_alias : Option < u64 > ,
971
978
/// An optional [`short_channel_id`] alias for this channel, randomly generated by our
972
979
/// counterparty and usable in place of [`short_channel_id`] in invoice route hints. Our
973
980
/// counterparty will recognize the alias provided here in place of the [`short_channel_id`]
@@ -1085,6 +1092,16 @@ impl ChannelDetails {
1085
1092
pub fn get_inbound_payment_scid ( & self ) -> Option < u64 > {
1086
1093
self . inbound_scid_alias . or ( self . short_channel_id )
1087
1094
}
1095
+
1096
+ /// Gets the current SCID which should be used to identify this channel for outbound payments.
1097
+ /// This should be used in [`Route`]s to describe the first hop or in other contexts where
1098
+ /// we're sending or forwarding a payment outbound over this channel.
1099
+ ///
1100
+ /// This is either the [`ChannelDetails::short_channel_id`], if set, or the
1101
+ /// [`ChannelDetails::outbound_scid_alias`]. See those for more information.
1102
+ pub fn get_outbound_payment_scid ( & self ) -> Option < u64 > {
1103
+ self . short_channel_id . or ( self . outbound_scid_alias )
1104
+ }
1088
1105
}
1089
1106
1090
1107
/// If a payment fails to send, it can be in one of several states. This enum is returned as the
@@ -1711,6 +1728,7 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
1711
1728
// `have_received_message` indicates that type negotiation has completed.
1712
1729
channel_type : if channel. have_received_message ( ) { Some ( channel. get_channel_type ( ) . clone ( ) ) } else { None } ,
1713
1730
short_channel_id : channel. get_short_channel_id ( ) ,
1731
+ outbound_scid_alias : if channel. is_live ( ) { Some ( channel. outbound_scid_alias ( ) ) } else { None } ,
1714
1732
inbound_scid_alias : channel. latest_inbound_scid_alias ( ) ,
1715
1733
channel_value_satoshis : channel. get_value_satoshis ( ) ,
1716
1734
unspendable_punishment_reserve : to_self_reserve_satoshis,
@@ -5994,6 +6012,7 @@ impl_writeable_tlv_based!(ChannelDetails, {
5994
6012
( 2 , channel_id, required) ,
5995
6013
( 3 , channel_type, option) ,
5996
6014
( 4 , counterparty, required) ,
6015
+ ( 5 , outbound_scid_alias, option) ,
5997
6016
( 6 , funding_txo, option) ,
5998
6017
( 8 , short_channel_id, option) ,
5999
6018
( 10 , channel_value_satoshis, required) ,
0 commit comments