@@ -1223,6 +1223,13 @@ pub struct ChannelDetails {
1223
1223
/// [`inbound_scid_alias`]: Self::inbound_scid_alias
1224
1224
/// [`get_inbound_payment_scid`]: Self::get_inbound_payment_scid
1225
1225
pub short_channel_id : Option < u64 > ,
1226
+ /// An optional [`short_channel_id`] alias for this channel, randomly generated by us and
1227
+ /// usable in place of [`short_channel_id`] to reference the channel in outbound routes even if
1228
+ /// the channel has not yet been confirmed (as long as [`confirmations_required`] is
1229
+ /// `Some(0)`).
1230
+ ///
1231
+ /// This will be `None` as long as the channel is not available for routing outbound payments.
1232
+ pub outbound_scid_alias : Option < u64 > ,
1226
1233
/// An optional [`short_channel_id`] alias for this channel, randomly generated by our
1227
1234
/// counterparty and usable in place of [`short_channel_id`] in invoice route hints. Our
1228
1235
/// counterparty will recognize the alias provided here in place of the [`short_channel_id`]
@@ -1328,6 +1335,16 @@ impl ChannelDetails {
1328
1335
pub fn get_inbound_payment_scid ( & self ) -> Option < u64 > {
1329
1336
self . inbound_scid_alias . or ( self . short_channel_id )
1330
1337
}
1338
+
1339
+ /// Gets the current SCID which should be used to identify this channel for outbound payments.
1340
+ /// This should be used in [`Route`]s to describe the first hop or in other contexts where
1341
+ /// we're sending or forwarding a payment outbound over this channel.
1342
+ ///
1343
+ /// This is either the [`ChannelDetails::short_channel_id`], if set, or the
1344
+ /// [`ChannelDetails::outbound_scid_alias`]. See those for more information.
1345
+ pub fn get_outbound_payment_scid ( & self ) -> Option < u64 > {
1346
+ self . short_channel_id . or ( self . outbound_scid_alias )
1347
+ }
1331
1348
}
1332
1349
1333
1350
/// If a payment fails to send, it can be in one of several states. This enum is returned as the
@@ -1949,6 +1966,7 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
1949
1966
// `have_received_message` indicates that type negotiation has completed.
1950
1967
channel_type : if channel. have_received_message ( ) { Some ( channel. get_channel_type ( ) . clone ( ) ) } else { None } ,
1951
1968
short_channel_id : channel. get_short_channel_id ( ) ,
1969
+ outbound_scid_alias : if channel. is_live ( ) { Some ( channel. outbound_scid_alias ( ) ) } else { None } ,
1952
1970
inbound_scid_alias : channel. latest_inbound_scid_alias ( ) ,
1953
1971
channel_value_satoshis : channel. get_value_satoshis ( ) ,
1954
1972
unspendable_punishment_reserve : to_self_reserve_satoshis,
@@ -6225,6 +6243,7 @@ impl_writeable_tlv_based!(ChannelDetails, {
6225
6243
( 2 , channel_id, required) ,
6226
6244
( 3 , channel_type, option) ,
6227
6245
( 4 , counterparty, required) ,
6246
+ ( 5 , outbound_scid_alias, option) ,
6228
6247
( 6 , funding_txo, option) ,
6229
6248
( 8 , short_channel_id, option) ,
6230
6249
( 10 , channel_value_satoshis, required) ,
0 commit comments