@@ -21,6 +21,7 @@ pub mod bump_transaction;
21
21
pub use bump_transaction:: BumpTransactionEvent ;
22
22
23
23
use crate :: chain:: keysinterface:: SpendableOutputDescriptor ;
24
+ use crate :: chain:: transaction:: OutPoint ;
24
25
use crate :: ln:: channelmanager:: { InterceptId , PaymentId } ;
25
26
use crate :: ln:: channel:: FUNDING_CONF_DEADLINE_BLOCKS ;
26
27
use crate :: ln:: features:: ChannelTypeFeatures ;
@@ -604,6 +605,50 @@ pub enum Event {
604
605
/// transaction.
605
606
claim_from_onchain_tx : bool ,
606
607
} ,
608
+ /// Indicates a channel has received sufficient confirmations and LDK is ready to send [`msgs::ChannelReady`].
609
+ ///
610
+ /// To signal readiness, call [`ChannelManager::signal_channel_readiness`]. To reject the
611
+ /// request, call [`ChannelManager::force_close_without_broadcasting_txn`].
612
+ ///
613
+ /// The event is only triggered when the [`UserConfig::manually_signal_channel_ready`]
614
+ /// config flag is set to true.
615
+ ///
616
+ /// [`ChannelManager::signal_channel_readiness`]: crate::ln::channelmanager::ChannelManager::signal_channel_readiness
617
+ /// [`ChannelManager::force_close_without_broadcasting_txn`]: crate::ln::channelmanager::ChannelManager::force_close_without_broadcasting_txn
618
+ /// [`UserConfig::manually_signal_channel_ready`]: crate::util::config::UserConfig::manually_signal_channel_ready
619
+ /// [`msgs::ChannelReady`]: crate::ln::msgs::ChannelReady
620
+ PendingChannelReady {
621
+ /// The channel ID of the channel.
622
+ ///
623
+ /// When responding to the request, the `channel_id` should be passed
624
+ /// back to the ChannelManager through [`ChannelManager::signal_channel_readiness`] to signal,
625
+ /// or through [`ChannelManager::force_close_without_broadcasting_txn`] to reject.
626
+ ///
627
+ /// [`ChannelManager::signal_channel_readiness`]: crate::ln::channelmanager::ChannelManager::signal_channel_readiness
628
+ /// [`ChannelManager::force_close_without_broadcasting_txn`]: crate::ln::channelmanager::ChannelManager::force_close_without_broadcasting_txn
629
+ channel_id : [ u8 ; 32 ] ,
630
+ /// The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound
631
+ /// channels, or to [`ChannelManager::accept_inbound_channel`] for inbound channels if
632
+ /// [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise
633
+ /// `user_channel_id` will be randomized for an inbound channel.
634
+ ///
635
+ /// [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
636
+ /// [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
637
+ /// [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels
638
+ user_channel_id : u128 ,
639
+ /// The node_id of the counterparty requesting to open the channel.
640
+ ///
641
+ /// When responding to the request, the `counterparty_node_id` should be passed
642
+ /// back to the `ChannelManager` through [`ChannelManager::signal_channel_readiness`] to
643
+ /// signal readiness, or through [`ChannelManager::force_close_without_broadcasting_txn`] to reject the
644
+ /// request.
645
+ ///
646
+ /// [`ChannelManager::signal_channel_readiness`]: crate::ln::channelmanager::ChannelManager::signal_channel_readiness
647
+ /// [`ChannelManager::force_close_without_broadcasting_txn`]: crate::ln::channelmanager::ChannelManager::force_close_without_broadcasting_txn
648
+ counterparty_node_id : PublicKey ,
649
+ /// The outpoint that holds the channel funds on-chain.
650
+ funding_outpoint : OutPoint ,
651
+ } ,
607
652
/// Used to indicate that a channel with the given `channel_id` is ready to
608
653
/// be used. This event is emitted either when the funding transaction has been confirmed
609
654
/// on-chain, or, in case of a 0conf channel, when both parties have confirmed the channel
@@ -923,6 +968,15 @@ impl Writeable for Event {
923
968
( 6 , channel_type, required) ,
924
969
} ) ;
925
970
} ,
971
+ & Event :: PendingChannelReady { ref channel_id, ref user_channel_id, ref counterparty_node_id, ref funding_outpoint } => {
972
+ 31u8 . write ( writer) ?;
973
+ write_tlv_fields ! ( writer, {
974
+ ( 0 , channel_id, required) ,
975
+ ( 2 , user_channel_id, required) ,
976
+ ( 4 , counterparty_node_id, required) ,
977
+ ( 6 , funding_outpoint, required)
978
+ } ) ;
979
+ } ,
926
980
// Note that, going forward, all new events must only write data inside of
927
981
// `write_tlv_fields`. Versions 0.0.101+ will ignore odd-numbered events that write
928
982
// data via `write_tlv_fields`.
@@ -1258,6 +1312,28 @@ impl MaybeReadable for Event {
1258
1312
} ;
1259
1313
f ( )
1260
1314
} ,
1315
+ 31u8 => {
1316
+ let f = || {
1317
+ let mut channel_id = [ 0 ; 32 ] ;
1318
+ let mut user_channel_id: u128 = 0 ;
1319
+ let mut counterparty_node_id = RequiredWrapper ( None ) ;
1320
+ let mut funding_outpoint = RequiredWrapper ( None ) ;
1321
+ read_tlv_fields ! ( reader, {
1322
+ ( 0 , channel_id, required) ,
1323
+ ( 2 , user_channel_id, required) ,
1324
+ ( 4 , counterparty_node_id, required) ,
1325
+ ( 6 , funding_outpoint, required) ,
1326
+ } ) ;
1327
+
1328
+ Ok ( Some ( Event :: PendingChannelReady {
1329
+ channel_id,
1330
+ user_channel_id,
1331
+ counterparty_node_id : counterparty_node_id. 0 . unwrap ( ) ,
1332
+ funding_outpoint : funding_outpoint. 0 . unwrap ( )
1333
+ } ) )
1334
+ } ;
1335
+ f ( )
1336
+ } ,
1261
1337
// Versions prior to 0.0.100 did not ignore odd types, instead returning InvalidValue.
1262
1338
// Version 0.0.100 failed to properly ignore odd types, possibly resulting in corrupt
1263
1339
// reads.
0 commit comments