mirror of
https://github.com/lightningdevkit/rust-lightning.git
synced 2025-02-25 07:17:40 +01:00
Add more information to OpenChannelRequest Event
This commit is contained in:
parent
a76ec06d23
commit
eb47656a46
3 changed files with 42 additions and 0 deletions
|
@ -1308,6 +1308,10 @@ pub enum Event {
|
||||||
///
|
///
|
||||||
/// [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
|
/// [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
|
||||||
channel_type: ChannelTypeFeatures,
|
channel_type: ChannelTypeFeatures,
|
||||||
|
/// True if this channel is (or will be) publicly-announced.
|
||||||
|
is_public: bool,
|
||||||
|
/// Channel parameters given by the counterparty.
|
||||||
|
params: msgs::ChannelParameters,
|
||||||
},
|
},
|
||||||
/// Indicates that the HTLC was accepted, but could not be processed when or after attempting to
|
/// Indicates that the HTLC was accepted, but could not be processed when or after attempting to
|
||||||
/// forward it.
|
/// forward it.
|
||||||
|
|
|
@ -7395,12 +7395,15 @@ where
|
||||||
MsgHandleErrInternal::from_chan_no_close(e, msg.common_fields.temporary_channel_id)
|
MsgHandleErrInternal::from_chan_no_close(e, msg.common_fields.temporary_channel_id)
|
||||||
)?;
|
)?;
|
||||||
let mut pending_events = self.pending_events.lock().unwrap();
|
let mut pending_events = self.pending_events.lock().unwrap();
|
||||||
|
let is_public = (msg.common_fields.channel_flags & 1) == 1;
|
||||||
pending_events.push_back((events::Event::OpenChannelRequest {
|
pending_events.push_back((events::Event::OpenChannelRequest {
|
||||||
temporary_channel_id: msg.common_fields.temporary_channel_id.clone(),
|
temporary_channel_id: msg.common_fields.temporary_channel_id.clone(),
|
||||||
counterparty_node_id: counterparty_node_id.clone(),
|
counterparty_node_id: counterparty_node_id.clone(),
|
||||||
funding_satoshis: msg.common_fields.funding_satoshis,
|
funding_satoshis: msg.common_fields.funding_satoshis,
|
||||||
push_msat: msg.push_msat,
|
push_msat: msg.push_msat,
|
||||||
channel_type,
|
channel_type,
|
||||||
|
is_public,
|
||||||
|
params: msg.common_fields.channel_parameters(),
|
||||||
}, None));
|
}, None));
|
||||||
peer_state.inbound_channel_request_by_id.insert(channel_id, InboundChannelRequest {
|
peer_state.inbound_channel_request_by_id.insert(channel_id, InboundChannelRequest {
|
||||||
open_channel_msg: msg.clone(),
|
open_channel_msg: msg.clone(),
|
||||||
|
|
|
@ -237,6 +237,41 @@ pub struct CommonOpenChannelFields {
|
||||||
pub channel_type: Option<ChannelTypeFeatures>,
|
pub channel_type: Option<ChannelTypeFeatures>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl CommonOpenChannelFields {
|
||||||
|
/// The [`ChannelParameters`] for this channel.
|
||||||
|
pub fn channel_parameters(&self) -> ChannelParameters {
|
||||||
|
ChannelParameters {
|
||||||
|
dust_limit_satoshis: self.dust_limit_satoshis,
|
||||||
|
max_htlc_value_in_flight_msat: self.max_htlc_value_in_flight_msat,
|
||||||
|
htlc_minimum_msat: self.htlc_minimum_msat,
|
||||||
|
commitment_feerate_sat_per_1000_weight: self.commitment_feerate_sat_per_1000_weight,
|
||||||
|
to_self_delay: self.to_self_delay,
|
||||||
|
max_accepted_htlcs: self.max_accepted_htlcs,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// A subset of [`CommonOpenChannelFields`], containing various parameters which are set by the
|
||||||
|
/// counterparty and which are not part of the channel funding transaction.
|
||||||
|
#[derive(Clone, Debug, Hash, PartialEq, Eq)]
|
||||||
|
pub struct ChannelParameters {
|
||||||
|
/// The threshold below which outputs on transactions broadcast by the channel initiator will be
|
||||||
|
/// omitted
|
||||||
|
pub dust_limit_satoshis: u64,
|
||||||
|
/// The maximum inbound HTLC value in flight towards channel initiator, in milli-satoshi
|
||||||
|
pub max_htlc_value_in_flight_msat: u64,
|
||||||
|
/// The minimum HTLC size incoming to channel initiator, in milli-satoshi
|
||||||
|
pub htlc_minimum_msat: u64,
|
||||||
|
/// The feerate for the commitment transaction set by the channel initiator until updated by
|
||||||
|
/// [`UpdateFee`]
|
||||||
|
pub commitment_feerate_sat_per_1000_weight: u32,
|
||||||
|
/// The number of blocks which the counterparty will have to wait to claim on-chain funds if they
|
||||||
|
/// broadcast a commitment transaction
|
||||||
|
pub to_self_delay: u16,
|
||||||
|
/// The maximum number of inbound HTLCs towards channel initiator
|
||||||
|
pub max_accepted_htlcs: u16,
|
||||||
|
}
|
||||||
|
|
||||||
/// An [`open_channel`] message to be sent to or received from a peer.
|
/// An [`open_channel`] message to be sent to or received from a peer.
|
||||||
///
|
///
|
||||||
/// Used in V1 channel establishment
|
/// Used in V1 channel establishment
|
||||||
|
|
Loading…
Add table
Reference in a new issue