Skip to content

Commit c3cc331

Browse files
committed
Update docs for ChannelDetails fields which change on splice
Various fields in `ChannelDetails` refer to channel information which changes on splice, which we ensure is consistently documented here.
1 parent fe5d942 commit c3cc331

File tree

1 file changed

+36
-6
lines changed

1 file changed

+36
-6
lines changed

lightning/src/ln/channel_state.rs

Lines changed: 36 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -275,25 +275,38 @@ impl_writeable_tlv_based!(ChannelCounterparty, {
275275
/// [`ChannelMonitor::get_claimable_balances`], calculated with respect to the corresponding on-chain
276276
/// transactions.
277277
///
278+
/// When a channel is spliced, most fields continue to refer to the original pre-splice channel
279+
/// state until the splice transaction reaches sufficient confirmations to be locked (and we
280+
/// exchange `splice_locked` messages with our peer). See individual fields for details.
281+
///
278282
/// [`ChannelManager::list_channels`]: crate::ln::channelmanager::ChannelManager::list_channels
279283
/// [`ChannelManager::list_usable_channels`]: crate::ln::channelmanager::ChannelManager::list_usable_channels
280284
/// [`ChainMonitor::get_claimable_balances`]: crate::chain::chainmonitor::ChainMonitor::get_claimable_balances
281285
/// [`ChannelMonitor::get_claimable_balances`]: crate::chain::channelmonitor::ChannelMonitor::get_claimable_balances
282286
#[derive(Clone, Debug, PartialEq)]
283287
pub struct ChannelDetails {
284-
/// The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
285-
/// thereafter this is the txid of the funding transaction xor the funding transaction output).
288+
/// The channel's ID (prior to initial channel setup this is a random 32 bytes, thereafter it is
289+
/// derived from channel funding or key material).
290+
///
286291
/// Note that this means this value is *not* persistent - it can change once during the
287292
/// lifetime of the channel.
288293
pub channel_id: ChannelId,
289294
/// Parameters which apply to our counterparty. See individual fields for more information.
290295
pub counterparty: ChannelCounterparty,
291296
/// The Channel's funding transaction output, if we've negotiated the funding transaction with
292297
/// our counterparty already.
298+
///
299+
/// When a channel is spliced, this continues to refer to the original pre-splice channel
300+
/// state until the splice transaction reaches sufficient confirmations to be locked (and we
301+
/// exchange `splice_locked` messages with our peer).
293302
pub funding_txo: Option<OutPoint>,
294303
/// The features which this channel operates with. See individual features for more info.
295304
///
296305
/// `None` until negotiation completes and the channel type is finalized.
306+
///
307+
/// When a channel is spliced, this continues to refer to the original pre-splice channel
308+
/// state until the splice transaction reaches sufficient confirmations to be locked (and we
309+
/// exchange `splice_locked` messages with our peer).
297310
pub channel_type: Option<ChannelTypeFeatures>,
298311
/// The position of the funding transaction in the chain. None if the funding transaction has
299312
/// not yet been confirmed and the channel fully opened.
@@ -304,6 +317,10 @@ pub struct ChannelDetails {
304317
/// For channels with [`confirmations_required`] set to `Some(0)`, [`outbound_scid_alias`] may
305318
/// be used in place of this in outbound routes. See [`get_outbound_payment_scid`].
306319
///
320+
/// When a channel is spliced, this continues to refer to the original pre-splice channel
321+
/// state until the splice transaction reaches sufficient confirmations to be locked (and we
322+
/// exchange `splice_locked` messages with our peer).
323+
///
307324
/// [`inbound_scid_alias`]: Self::inbound_scid_alias
308325
/// [`outbound_scid_alias`]: Self::outbound_scid_alias
309326
/// [`get_inbound_payment_scid`]: Self::get_inbound_payment_scid
@@ -317,6 +334,10 @@ pub struct ChannelDetails {
317334
///
318335
/// This will be `None` as long as the channel is not available for routing outbound payments.
319336
///
337+
/// When a channel is spliced, this continues to refer to the original pre-splice channel
338+
/// state until the splice transaction reaches sufficient confirmations to be locked (and we
339+
/// exchange `splice_locked` messages with our peer).
340+
///
320341
/// [`short_channel_id`]: Self::short_channel_id
321342
/// [`confirmations_required`]: Self::confirmations_required
322343
pub outbound_scid_alias: Option<u64>,
@@ -331,6 +352,10 @@ pub struct ChannelDetails {
331352
/// [`short_channel_id`]: Self::short_channel_id
332353
pub inbound_scid_alias: Option<u64>,
333354
/// The value, in satoshis, of this channel as appears in the funding output
355+
///
356+
/// When a channel is spliced, this continues to refer to the original pre-splice channel
357+
/// state until the splice transaction reaches sufficient confirmations to be locked (and we
358+
/// exchange `splice_locked` messages with our peer).
334359
pub channel_value_satoshis: u64,
335360
/// The value, in satoshis, that must always be held in the channel for us. This value ensures
336361
/// that if we broadcast a revoked state, our counterparty can punish us by claiming at least
@@ -450,7 +475,12 @@ pub struct ChannelDetails {
450475
///
451476
/// This field is empty for objects serialized with LDK versions prior to 0.0.122.
452477
pub pending_outbound_htlcs: Vec<OutboundHTLCDetails>,
453-
/// The witness script that is used to lock the channel's funding output to commitment transactions.
478+
/// The witness script that is used to lock the channel's funding output to commitment
479+
/// transactions.
480+
///
481+
/// When a channel is spliced, this continues to refer to the original funding output (which
482+
/// was spent by the splice transaction) until the splice transaction reached sufficient
483+
/// confirmations to be locked (and we exchange `splice_locked` messages with our peer).
454484
///
455485
/// This field will be `None` for objects serialized with LDK versions prior to 0.2.0.
456486
pub funding_redeem_script: Option<bitcoin::ScriptBuf>,
@@ -481,9 +511,9 @@ impl ChannelDetails {
481511

482512
/// Gets the funding output for this channel, if available.
483513
///
484-
/// During a splice, the funding output will change and this value will be updated
485-
/// after the splice transaction has reached sufficient confirmations and we've
486-
/// exchanged `splice_locked` messages.
514+
/// When a channel is spliced, this continues to refer to the original funding output (which
515+
/// was spent by the splice transaction) until the splice transaction reaches sufficient
516+
/// confirmations to be locked (and we exchange `splice_locked` messages with our peer).
487517
pub fn get_funding_output(&self) -> Option<bitcoin::TxOut> {
488518
match self.funding_redeem_script.as_ref() {
489519
None => None,

0 commit comments

Comments
 (0)