Skip to content

Commit 24ba584

Browse files
committed
Implement support for accepting V2 channels
1 parent f71bbb9 commit 24ba584

File tree

4 files changed

+638
-156
lines changed

4 files changed

+638
-156
lines changed

lightning/src/events/mod.rs

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -606,6 +606,20 @@ impl_writeable_tlv_based_enum_upgradable!(PaymentFailureReason,
606606
(10, UnexpectedError) => {},
607607
);
608608

609+
/// Used to indicate the kind of funding for this channel by the channel acceptor (us).
610+
///
611+
/// Allows the differentiation between a request for a dual-funded and non-dual-funded channel.
612+
#[derive(Clone, Debug, PartialEq, Eq)]
613+
pub enum InboundChannelFunds {
614+
/// For a non-dual-funded channel, the `push_msat` value from the channel initiator to us.
615+
PushMsat(u64),
616+
/// Indicates the open request is for a dual funded channel.
617+
///
618+
/// Note that these channels do not support starting with initial funds pushed from the counterparty,
619+
/// who is the channel opener in this case.
620+
DualFunded,
621+
}
622+
609623
/// An Event which you should probably take some action in response to.
610624
///
611625
/// Note that while Writeable and Readable are implemented for Event, you probably shouldn't use
@@ -1337,9 +1351,10 @@ pub enum Event {
13371351
},
13381352
/// Indicates a request to open a new channel by a peer.
13391353
///
1340-
/// To accept the request, call [`ChannelManager::accept_inbound_channel`]. To reject the request,
1341-
/// call [`ChannelManager::force_close_without_broadcasting_txn`]. Note that a ['ChannelClosed`]
1342-
/// event will _not_ be triggered if the channel is rejected.
1354+
/// To accept the request (and in the case of a dual-funded channel, not contribute funds),
1355+
/// call [`ChannelManager::accept_inbound_channel`].
1356+
/// To reject the request, call [`ChannelManager::force_close_without_broadcasting_txn`].
1357+
/// Note that a ['ChannelClosed`] event will _not_ be triggered if the channel is rejected.
13431358
///
13441359
/// The event is only triggered when a new open channel request is received and the
13451360
/// [`UserConfig::manually_accept_inbound_channels`] config flag is set to true.
@@ -1373,8 +1388,10 @@ pub enum Event {
13731388
counterparty_node_id: PublicKey,
13741389
/// The channel value of the requested channel.
13751390
funding_satoshis: u64,
1376-
/// Our starting balance in the channel if the request is accepted, in milli-satoshi.
1377-
push_msat: u64,
1391+
/// If `channel_negotiation_type` is `InboundChannelFunds::DualFunded`, this indicates that the peer wishes to
1392+
/// open a dual-funded channel. Otherwise, this field will be `InboundChannelFunds::PushMsats`,
1393+
/// indicating the `push_msats` value our peer is pushing to us for a non-dual-funded channel.
1394+
channel_negotiation_type: InboundChannelFunds,
13781395
/// The features that this channel will operate with. If you reject the channel, a
13791396
/// well-behaved counterparty may automatically re-attempt the channel with a new set of
13801397
/// feature flags.

0 commit comments

Comments
 (0)