Skip to content

Commit fe0f845

Browse files
authored
Merge pull request #2428 from waterson/create-channel-after-accept
Wait to create a channel until after accepting.
2 parents 645e056 + 0184727 commit fe0f845

File tree

5 files changed

+210
-219
lines changed

5 files changed

+210
-219
lines changed

lightning/src/events/mod.rs

+17-5
Original file line numberDiff line numberDiff line change
@@ -343,11 +343,15 @@ pub enum Event {
343343
channel_value_satoshis: u64,
344344
/// The script which should be used in the transaction output.
345345
output_script: Script,
346-
/// The `user_channel_id` value passed in to [`ChannelManager::create_channel`], or a
347-
/// random value for an inbound channel. This may be zero for objects serialized with LDK
348-
/// versions prior to 0.0.113.
346+
/// The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound
347+
/// channels, or to [`ChannelManager::accept_inbound_channel`] for inbound channels if
348+
/// [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise
349+
/// `user_channel_id` will be randomized for an inbound channel. This may be zero for objects
350+
/// serialized with LDK versions prior to 0.0.113.
349351
///
350352
/// [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
353+
/// [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
354+
/// [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels
351355
user_channel_id: u128,
352356
},
353357
/// Indicates that we've been offered a payment and it needs to be claimed via calling
@@ -751,6 +755,13 @@ pub enum Event {
751755
},
752756
/// Used to indicate that a previously opened channel with the given `channel_id` is in the
753757
/// process of closure.
758+
///
759+
/// Note that this event is only triggered for accepted channels: if the
760+
/// [`UserConfig::manually_accept_inbound_channels`] config flag is set to true and the channel is
761+
/// rejected, no `ChannelClosed` event will be sent.
762+
///
763+
/// [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
764+
/// [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels
754765
ChannelClosed {
755766
/// The `channel_id` of the channel which has been closed. Note that on-chain transactions
756767
/// resolving the channel are likely still awaiting confirmation.
@@ -787,8 +798,9 @@ pub enum Event {
787798
},
788799
/// Indicates a request to open a new channel by a peer.
789800
///
790-
/// To accept the request, call [`ChannelManager::accept_inbound_channel`]. To reject the
791-
/// request, call [`ChannelManager::force_close_without_broadcasting_txn`].
801+
/// To accept the request, call [`ChannelManager::accept_inbound_channel`]. To reject the request,
802+
/// call [`ChannelManager::force_close_without_broadcasting_txn`]. Note that a ['ChannelClosed`]
803+
/// event will _not_ be triggered if the channel is rejected.
792804
///
793805
/// The event is only triggered when a new open channel request is received and the
794806
/// [`UserConfig::manually_accept_inbound_channels`] config flag is set to true.

0 commit comments

Comments
 (0)