@@ -505,6 +505,27 @@ pub enum Event {
505
505
/// transaction.
506
506
claim_from_onchain_tx : bool ,
507
507
} ,
508
+ /// Used to indicate that a previously opened channel with the given `channel_id` is ready to
509
+ /// be used. This event is emitted either when the funding transaction has been confirmed
510
+ /// on-chain, or, in case of a 0conf channel, when both parties have confirmed the channel
511
+ /// establishment.
512
+ ChannelEstablished {
513
+ /// The channel_id of the channel that is ready.
514
+ channel_id : [ u8 ; 32 ] ,
515
+ /// The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound
516
+ /// channels, or to [`ChannelManager::accept_inbound_channel`] for inbound channels if
517
+ /// [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise
518
+ /// `user_channel_id` will be 0 for an inbound channel.
519
+ ///
520
+ /// [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
521
+ /// [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
522
+ /// [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels
523
+ user_channel_id : u64 ,
524
+ /// The node_id of the channel counterparty.
525
+ counterparty_node_id : PublicKey ,
526
+ /// The features that this channel will operate with.
527
+ channel_type : ChannelTypeFeatures ,
528
+ } ,
508
529
/// Used to indicate that a previously opened channel with the given `channel_id` is in the
509
530
/// process of closure.
510
531
ChannelClosed {
@@ -753,6 +774,15 @@ impl Writeable for Event {
753
774
( 2 , failed_next_destination, required) ,
754
775
} )
755
776
} ,
777
+ & Event :: ChannelEstablished { ref channel_id, ref user_channel_id, ref counterparty_node_id, ref channel_type } => {
778
+ 27u8 . write ( writer) ?;
779
+ write_tlv_fields ! ( writer, {
780
+ ( 0 , channel_id, required) ,
781
+ ( 1 , user_channel_id, required) ,
782
+ ( 2 , counterparty_node_id, required) ,
783
+ ( 3 , channel_type, required) ,
784
+ } ) ;
785
+ } ,
756
786
// Note that, going forward, all new events must only write data inside of
757
787
// `write_tlv_fields`. Versions 0.0.101+ will ignore odd-numbered events that write
758
788
// data via `write_tlv_fields`.
@@ -1033,6 +1063,27 @@ impl MaybeReadable for Event {
1033
1063
} ;
1034
1064
f ( )
1035
1065
} ,
1066
+ 27u8 => {
1067
+ let f = || {
1068
+ let mut channel_id = [ 0 ; 32 ] ;
1069
+ let mut user_channel_id: u64 = 0 ;
1070
+ let mut counterparty_node_id_opt = None ;
1071
+ let mut channel_type_opt = None ;
1072
+ read_tlv_fields ! ( reader, {
1073
+ ( 0 , channel_id, required) ,
1074
+ ( 1 , user_channel_id, required) ,
1075
+ ( 2 , counterparty_node_id_opt, option) ,
1076
+ ( 3 , channel_type_opt, option) ,
1077
+ } ) ;
1078
+
1079
+ Ok ( Some ( Event :: ChannelEstablished { channel_id,
1080
+ user_channel_id,
1081
+ counterparty_node_id : counterparty_node_id_opt. unwrap ( ) ,
1082
+ channel_type : channel_type_opt. unwrap ( )
1083
+ } ) )
1084
+ } ;
1085
+ f ( )
1086
+ } ,
1036
1087
// Versions prior to 0.0.100 did not ignore odd types, instead returning InvalidValue.
1037
1088
// Version 0.0.100 failed to properly ignore odd types, possibly resulting in corrupt
1038
1089
// reads.
0 commit comments