@@ -318,23 +318,30 @@ pub enum ClosureReason {
318318 /// [`UntrustedString`]: crate::types::string::UntrustedString
319319 peer_msg : UntrustedString ,
320320 } ,
321- /// Closure generated from [`ChannelManager::force_close_channel`], called by the user.
321+ /// Closure generated from [`ChannelManager::force_close_broadcasting_latest_txn`] or
322+ /// [`ChannelManager::force_close_all_channels_broadcasting_latest_txn`], called by the user.
322323 ///
323- /// [`ChannelManager::force_close_channel`]: crate::ln::channelmanager::ChannelManager::force_close_channel.
324+ /// [`ChannelManager::force_close_broadcasting_latest_txn`]: crate::ln::channelmanager::ChannelManager::force_close_broadcasting_latest_txn
325+ /// [`ChannelManager::force_close_all_channels_broadcasting_latest_txn`]: crate::ln::channelmanager::ChannelManager::force_close_all_channels_broadcasting_latest_txn
324326 HolderForceClosed {
325327 /// Whether or not the latest transaction was broadcasted when the channel was force
326328 /// closed.
327329 ///
328- /// Channels closed using [`ChannelManager::force_close_broadcasting_latest_txn`] will have
329- /// this field set to true, whereas channels closed using [`ChannelManager::force_close_without_broadcasting_txn`]
330- /// or force- closed prior to being funded will have this field set to false .
330+ /// This will be set to `Some(true)` for any channels closed after their funding
331+ /// transaction was (or might have been) broadcasted, and `Some(false)` for any channels
332+ /// closed prior to their funding transaction being broadcasted .
331333 ///
332334 /// This will be `None` for objects generated or written by LDK 0.0.123 and
333335 /// earlier.
334- ///
335- /// [`ChannelManager::force_close_broadcasting_latest_txn`]: crate::ln::channelmanager::ChannelManager::force_close_broadcasting_latest_txn.
336- /// [`ChannelManager::force_close_without_broadcasting_txn`]: crate::ln::channelmanager::ChannelManager::force_close_without_broadcasting_txn.
337336 broadcasted_latest_txn : Option < bool > ,
337+ /// The error message provided to [`ChannelManager::force_close_broadcasting_latest_txn`] or
338+ /// [`ChannelManager::force_close_all_channels_broadcasting_latest_txn`].
339+ ///
340+ /// This will be the empty string for objects generated or written by LDK 0.1 and earlier.
341+ ///
342+ /// [`ChannelManager::force_close_broadcasting_latest_txn`]: crate::ln::channelmanager::ChannelManager::force_close_broadcasting_latest_txn
343+ /// [`ChannelManager::force_close_all_channels_broadcasting_latest_txn`]: crate::ln::channelmanager::ChannelManager::force_close_all_channels_broadcasting_latest_txn
344+ message : String ,
338345 } ,
339346 /// The channel was closed after negotiating a cooperative close and we've now broadcasted
340347 /// the cooperative close transaction. Note the shutdown may have been initiated by us.
@@ -356,7 +363,8 @@ pub enum ClosureReason {
356363 /// commitment transaction came from our counterparty, but it may also have come from
357364 /// a copy of our own `ChannelMonitor`.
358365 CommitmentTxConfirmed ,
359- /// The funding transaction failed to confirm in a timely manner on an inbound channel.
366+ /// The funding transaction failed to confirm in a timely manner on an inbound channel or the
367+ /// counterparty failed to fund the channel in a timely manner.
360368 FundingTimedOut ,
361369 /// Closure generated from processing an event, likely a HTLC forward/relay/reception.
362370 ProcessingError {
@@ -383,6 +391,12 @@ pub enum ClosureReason {
383391 /// The counterparty requested a cooperative close of a channel that had not been funded yet.
384392 /// The channel has been immediately closed.
385393 CounterpartyCoopClosedUnfundedChannel ,
394+ /// We requested a cooperative close of a channel that had not been funded yet.
395+ /// The channel has been immediately closed.
396+ ///
397+ /// Note that events containing this variant will be lost on downgrade to a version of LDK
398+ /// prior to 0.2.
399+ LocallyCoopClosedUnfundedChannel ,
386400 /// Another channel in the same funding batch closed before the funding transaction
387401 /// was ready to be broadcast.
388402 FundingBatchClosure ,
@@ -412,12 +426,13 @@ impl core::fmt::Display for ClosureReason {
412426 ClosureReason :: CounterpartyForceClosed { peer_msg } => {
413427 f. write_fmt ( format_args ! ( "counterparty force-closed with message: {}" , peer_msg) )
414428 } ,
415- ClosureReason :: HolderForceClosed { broadcasted_latest_txn } => {
416- f. write_str ( "user force-closed the channel" ) ?;
429+ ClosureReason :: HolderForceClosed { broadcasted_latest_txn, message } => {
430+ f. write_str ( "user force-closed the channel with the message \" " ) ?;
431+ f. write_str ( message) ?;
417432 if let Some ( brodcasted) = broadcasted_latest_txn {
418433 write ! (
419434 f,
420- " and {} the latest transaction" ,
435+ "\" and {} the latest transaction" ,
421436 if * brodcasted { "broadcasted" } else { "elected not to broadcast" }
422437 )
423438 } else {
@@ -454,6 +469,9 @@ impl core::fmt::Display for ClosureReason {
454469 ClosureReason :: CounterpartyCoopClosedUnfundedChannel => {
455470 f. write_str ( "the peer requested the unfunded channel be closed" )
456471 } ,
472+ ClosureReason :: LocallyCoopClosedUnfundedChannel => {
473+ f. write_str ( "we requested the unfunded channel be closed" )
474+ } ,
457475 ClosureReason :: FundingBatchClosure => {
458476 f. write_str ( "another channel in the same funding batch closed" )
459477 } ,
@@ -472,7 +490,10 @@ impl core::fmt::Display for ClosureReason {
472490impl_writeable_tlv_based_enum_upgradable ! ( ClosureReason ,
473491 ( 0 , CounterpartyForceClosed ) => { ( 1 , peer_msg, required) } ,
474492 ( 1 , FundingTimedOut ) => { } ,
475- ( 2 , HolderForceClosed ) => { ( 1 , broadcasted_latest_txn, option) } ,
493+ ( 2 , HolderForceClosed ) => {
494+ ( 1 , broadcasted_latest_txn, option) ,
495+ ( 3 , message, ( default_value, String :: new( ) ) ) ,
496+ } ,
476497 ( 6 , CommitmentTxConfirmed ) => { } ,
477498 ( 4 , LegacyCooperativeClosure ) => { } ,
478499 ( 8 , ProcessingError ) => { ( 1 , err, required) } ,
@@ -487,6 +508,7 @@ impl_writeable_tlv_based_enum_upgradable!(ClosureReason,
487508 ( 0 , peer_feerate_sat_per_kw, required) ,
488509 ( 2 , required_feerate_sat_per_kw, required) ,
489510 } ,
511+ ( 25 , LocallyCoopClosedUnfundedChannel ) => { } ,
490512) ;
491513
492514/// The type of HTLC handling performed in [`Event::HTLCHandlingFailed`].
@@ -1461,7 +1483,7 @@ pub enum Event {
14611483 ///
14621484 /// To accept the request (and in the case of a dual-funded channel, not contribute funds),
14631485 /// call [`ChannelManager::accept_inbound_channel`].
1464- /// To reject the request, call [`ChannelManager::force_close_without_broadcasting_txn `].
1486+ /// To reject the request, call [`ChannelManager::force_close_broadcasting_latest_txn `].
14651487 /// Note that a ['ChannelClosed`] event will _not_ be triggered if the channel is rejected.
14661488 ///
14671489 /// The event is only triggered when a new open channel request is received and the
@@ -1472,27 +1494,27 @@ pub enum Event {
14721494 /// returning `Err(ReplayEvent ())`) and won't be persisted across restarts.
14731495 ///
14741496 /// [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
1475- /// [`ChannelManager::force_close_without_broadcasting_txn `]: crate::ln::channelmanager::ChannelManager::force_close_without_broadcasting_txn
1497+ /// [`ChannelManager::force_close_broadcasting_latest_txn `]: crate::ln::channelmanager::ChannelManager::force_close_broadcasting_latest_txn
14761498 /// [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels
14771499 OpenChannelRequest {
14781500 /// The temporary channel ID of the channel requested to be opened.
14791501 ///
14801502 /// When responding to the request, the `temporary_channel_id` should be passed
14811503 /// back to the ChannelManager through [`ChannelManager::accept_inbound_channel`] to accept,
1482- /// or through [`ChannelManager::force_close_without_broadcasting_txn `] to reject.
1504+ /// or through [`ChannelManager::force_close_broadcasting_latest_txn `] to reject.
14831505 ///
14841506 /// [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
1485- /// [`ChannelManager::force_close_without_broadcasting_txn `]: crate::ln::channelmanager::ChannelManager::force_close_without_broadcasting_txn
1507+ /// [`ChannelManager::force_close_broadcasting_latest_txn `]: crate::ln::channelmanager::ChannelManager::force_close_broadcasting_latest_txn
14861508 temporary_channel_id : ChannelId ,
14871509 /// The node_id of the counterparty requesting to open the channel.
14881510 ///
14891511 /// When responding to the request, the `counterparty_node_id` should be passed
14901512 /// back to the `ChannelManager` through [`ChannelManager::accept_inbound_channel`] to
1491- /// accept the request, or through [`ChannelManager::force_close_without_broadcasting_txn`] to reject the
1492- /// request.
1513+ /// accept the request, or through [`ChannelManager::force_close_broadcasting_latest_txn`]
1514+ /// to reject the request.
14931515 ///
14941516 /// [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
1495- /// [`ChannelManager::force_close_without_broadcasting_txn `]: crate::ln::channelmanager::ChannelManager::force_close_without_broadcasting_txn
1517+ /// [`ChannelManager::force_close_broadcasting_latest_txn `]: crate::ln::channelmanager::ChannelManager::force_close_broadcasting_latest_txn
14961518 counterparty_node_id : PublicKey ,
14971519 /// The channel value of the requested channel.
14981520 funding_satoshis : u64 ,
0 commit comments