Skip to content

Commit cfa656e

Browse files
committed
Document 0conf channels will be rejected.
1 parent 79411c7 commit cfa656e

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

lightning/src/ln/channelmanager.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -4159,6 +4159,10 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
41594159
/// [`Event::ChannelClosed::user_channel_id`] to allow tracking of which events correspond
41604160
/// with which `accept_inbound_channel`/`accept_inbound_channel_from_trusted_peer_0conf` call.
41614161
///
4162+
/// Note that this method will return an error and reject the channel, if it requires support
4163+
/// for zero confirmations. Instead, `accept_inbound_channel_from_trusted_peer_0conf` must be
4164+
/// used to accept such channels.
4165+
///
41624166
/// [`Event::OpenChannelRequest`]: events::Event::OpenChannelRequest
41634167
/// [`Event::ChannelClosed::user_channel_id`]: events::Event::ChannelClosed::user_channel_id
41644168
pub fn accept_inbound_channel(&self, temporary_channel_id: &[u8; 32], counterparty_node_id: &PublicKey, user_channel_id: u64) -> Result<(), APIError> {
@@ -4209,7 +4213,7 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
42094213
msg: msgs::ErrorMessage { channel_id: temporary_channel_id.clone(), data: "No zero confirmation channels accepted".to_owned(), }
42104214
}
42114215
};
4212-
channel_state.pending_msg_events.push(send_err_msg_event);
4216+
channel_state.pending_msg_events.push(send_msg_err_event);
42134217
let _ = remove_channel!(self, channel_state, channel);
42144218
return Err(APIError::APIMisuseError { err: "Please use accept_inbound_channel_from_trusted_peer_0conf to accept channels with zero confirmations.".to_owned() });
42154219
}

lightning/src/util/events.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,8 @@ pub enum Event {
397397
/// transaction.
398398
claim_from_onchain_tx: bool,
399399
},
400-
/// Used to indicate that a channel with the given `channel_id` is in the process of closure.
400+
/// Used to indicate that a previously opened channel with the given `channel_id` is in the
401+
/// process of closure.
401402
ChannelClosed {
402403
/// The channel_id of the channel which has been closed. Note that on-chain transactions
403404
/// resolving the channel are likely still awaiting confirmation.

0 commit comments

Comments
 (0)