@@ -497,6 +497,29 @@ 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
+ /// The funding transaction which was signed by the counterparty.
521
+ funding_tx : Transaction ,
522
+ } ,
500
523
/// Used to indicate that the client should generate a funding transaction with the given
501
524
/// parameters and then call [`ChannelManager::funding_transaction_generated`].
502
525
/// Generated in [`ChannelManager`] message handling.
@@ -1404,6 +1427,14 @@ impl Writeable for Event {
1404
1427
35u8 . write ( writer) ?;
1405
1428
// Never write ConnectionNeeded events as buffered onion messages aren't serialized.
1406
1429
} ,
1430
+ & Event :: FundingSigned { ref channel_id, ref user_channel_id, ref funding_tx } => {
1431
+ 37u8 . write ( writer) ?;
1432
+ write_tlv_fields ! ( writer, {
1433
+ ( 0 , channel_id, required) ,
1434
+ ( 2 , user_channel_id, required) ,
1435
+ ( 4 , funding_tx, required) ,
1436
+ } ) ;
1437
+ } ,
1407
1438
// Note that, going forward, all new events must only write data inside of
1408
1439
// `write_tlv_fields`. Versions 0.0.101+ will ignore odd-numbered events that write
1409
1440
// data via `write_tlv_fields`.
@@ -1814,6 +1845,24 @@ impl MaybeReadable for Event {
1814
1845
} ,
1815
1846
// Note that we do not write a length-prefixed TLV for ConnectionNeeded events.
1816
1847
35u8 => Ok ( None ) ,
1848
+ 37u8 => {
1849
+ let mut f = || {
1850
+ let mut channel_id = ChannelId :: new_zero ( ) ;
1851
+ let mut user_channel_id: u128 = 0 ;
1852
+ let mut funding_tx = Transaction { version : 2 , lock_time : LockTime :: ZERO , input : Vec :: new ( ) , output : Vec :: new ( ) } ;
1853
+ read_tlv_fields ! ( reader, {
1854
+ ( 0 , channel_id, required) ,
1855
+ ( 2 , user_channel_id, required) ,
1856
+ ( 4 , funding_tx, required) ,
1857
+ } ) ;
1858
+ Ok ( Some ( Event :: FundingSigned {
1859
+ channel_id,
1860
+ user_channel_id,
1861
+ funding_tx,
1862
+ } ) )
1863
+ } ;
1864
+ f ( )
1865
+ } ,
1817
1866
// Versions prior to 0.0.100 did not ignore odd types, instead returning InvalidValue.
1818
1867
// Version 0.0.100 failed to properly ignore odd types, possibly resulting in corrupt
1819
1868
// reads.
0 commit comments