@@ -497,6 +497,27 @@ impl_writeable_tlv_based_enum!(PaymentFailureReason,
497
497
/// written as it makes no sense to respond to it after reconnecting to peers).
498
498
#[ derive( Clone , Debug , PartialEq , Eq ) ]
499
499
pub enum Event {
500
+ /// Used to indicate that the counterparty node has sent `FundingSigned` msg but we are yet to
501
+ /// broadcast the funding transaction.
502
+ ///
503
+ /// After you receive this event, you should broadcast the funding transaction and then call
504
+ //// [`ChannelManager::funding_transaction_broadcasted`]. <-- not implemtened yet
505
+ /// // should we have some timeout for this?
506
+ //// [`ChannelManager::funding_transaction_broadcasted`]: crate::ln::channelmanager::ChannelManager::funding_transaction_broadcasted
507
+ FundingSigned {
508
+ /// The `channel_id` indicating which channel has completed the `FundingSigned` stage.
509
+ channel_id : ChannelId ,
510
+ /// The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound
511
+ /// channels, or to [`ChannelManager::accept_inbound_channel`] for inbound channels if
512
+ /// [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise
513
+ /// `user_channel_id` will be randomized for an inbound channel. This may be zero for objects
514
+ /// serialized with LDK versions prior to 0.0.113.
515
+ ///
516
+ /// [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
517
+ /// [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
518
+ /// [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels
519
+ user_channel_id : u128 ,
520
+ } ,
500
521
/// Used to indicate that the client should generate a funding transaction with the given
501
522
/// parameters and then call [`ChannelManager::funding_transaction_generated`].
502
523
/// Generated in [`ChannelManager`] message handling.
@@ -1404,6 +1425,13 @@ impl Writeable for Event {
1404
1425
35u8 . write ( writer) ?;
1405
1426
// Never write ConnectionNeeded events as buffered onion messages aren't serialized.
1406
1427
} ,
1428
+ & Event :: FundingSigned { ref channel_id, ref user_channel_id } => {
1429
+ 37u8 . write ( writer) ?;
1430
+ write_tlv_fields ! ( writer, {
1431
+ ( 0 , channel_id, required) ,
1432
+ ( 2 , user_channel_id, required) ,
1433
+ } ) ;
1434
+ } ,
1407
1435
// Note that, going forward, all new events must only write data inside of
1408
1436
// `write_tlv_fields`. Versions 0.0.101+ will ignore odd-numbered events that write
1409
1437
// data via `write_tlv_fields`.
@@ -1814,6 +1842,22 @@ impl MaybeReadable for Event {
1814
1842
} ,
1815
1843
// Note that we do not write a length-prefixed TLV for ConnectionNeeded events.
1816
1844
35u8 => Ok ( None ) ,
1845
+ 37u8 => {
1846
+ let mut f = || {
1847
+ let mut channel_id = ChannelId :: new_zero ( ) ;
1848
+ let mut user_channel_id: u128 = 0 ;
1849
+ read_tlv_fields ! ( reader, {
1850
+ ( 0 , channel_id, required) ,
1851
+ ( 2 , user_channel_id, required) ,
1852
+ } ) ;
1853
+
1854
+ Ok ( Some ( Event :: FundingSigned {
1855
+ channel_id,
1856
+ user_channel_id,
1857
+ } ) )
1858
+ } ;
1859
+ f ( )
1860
+ } ,
1817
1861
// Versions prior to 0.0.100 did not ignore odd types, instead returning InvalidValue.
1818
1862
// Version 0.0.100 failed to properly ignore odd types, possibly resulting in corrupt
1819
1863
// reads.
0 commit comments