@@ -318,23 +318,30 @@ pub enum ClosureReason {
318
318
/// [`UntrustedString`]: crate::types::string::UntrustedString
319
319
peer_msg : UntrustedString ,
320
320
} ,
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.
322
323
///
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
324
326
HolderForceClosed {
325
327
/// Whether or not the latest transaction was broadcasted when the channel was force
326
328
/// closed.
327
329
///
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 .
331
333
///
332
334
/// This will be `None` for objects generated or written by LDK 0.0.123 and
333
335
/// 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.
337
336
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 ,
338
345
} ,
339
346
/// The channel was closed after negotiating a cooperative close and we've now broadcasted
340
347
/// the cooperative close transaction. Note the shutdown may have been initiated by us.
@@ -356,7 +363,8 @@ pub enum ClosureReason {
356
363
/// commitment transaction came from our counterparty, but it may also have come from
357
364
/// a copy of our own `ChannelMonitor`.
358
365
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.
360
368
FundingTimedOut ,
361
369
/// Closure generated from processing an event, likely a HTLC forward/relay/reception.
362
370
ProcessingError {
@@ -383,6 +391,12 @@ pub enum ClosureReason {
383
391
/// The counterparty requested a cooperative close of a channel that had not been funded yet.
384
392
/// The channel has been immediately closed.
385
393
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 ,
386
400
/// Another channel in the same funding batch closed before the funding transaction
387
401
/// was ready to be broadcast.
388
402
FundingBatchClosure ,
@@ -412,12 +426,13 @@ impl core::fmt::Display for ClosureReason {
412
426
ClosureReason :: CounterpartyForceClosed { peer_msg } => {
413
427
f. write_fmt ( format_args ! ( "counterparty force-closed with message: {}" , peer_msg) )
414
428
} ,
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) ?;
417
432
if let Some ( brodcasted) = broadcasted_latest_txn {
418
433
write ! (
419
434
f,
420
- " and {} the latest transaction" ,
435
+ "\" and {} the latest transaction" ,
421
436
if * brodcasted { "broadcasted" } else { "elected not to broadcast" }
422
437
)
423
438
} else {
@@ -454,6 +469,9 @@ impl core::fmt::Display for ClosureReason {
454
469
ClosureReason :: CounterpartyCoopClosedUnfundedChannel => {
455
470
f. write_str ( "the peer requested the unfunded channel be closed" )
456
471
} ,
472
+ ClosureReason :: LocallyCoopClosedUnfundedChannel => {
473
+ f. write_str ( "we requested the unfunded channel be closed" )
474
+ } ,
457
475
ClosureReason :: FundingBatchClosure => {
458
476
f. write_str ( "another channel in the same funding batch closed" )
459
477
} ,
@@ -472,7 +490,10 @@ impl core::fmt::Display for ClosureReason {
472
490
impl_writeable_tlv_based_enum_upgradable ! ( ClosureReason ,
473
491
( 0 , CounterpartyForceClosed ) => { ( 1 , peer_msg, required) } ,
474
492
( 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
+ } ,
476
497
( 6 , CommitmentTxConfirmed ) => { } ,
477
498
( 4 , LegacyCooperativeClosure ) => { } ,
478
499
( 8 , ProcessingError ) => { ( 1 , err, required) } ,
@@ -487,6 +508,7 @@ impl_writeable_tlv_based_enum_upgradable!(ClosureReason,
487
508
( 0 , peer_feerate_sat_per_kw, required) ,
488
509
( 2 , required_feerate_sat_per_kw, required) ,
489
510
} ,
511
+ ( 25 , LocallyCoopClosedUnfundedChannel ) => { } ,
490
512
) ;
491
513
492
514
/// The type of HTLC handling performed in [`Event::HTLCHandlingFailed`].
@@ -1461,7 +1483,7 @@ pub enum Event {
1461
1483
///
1462
1484
/// To accept the request (and in the case of a dual-funded channel, not contribute funds),
1463
1485
/// 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 `].
1465
1487
/// Note that a ['ChannelClosed`] event will _not_ be triggered if the channel is rejected.
1466
1488
///
1467
1489
/// The event is only triggered when a new open channel request is received and the
@@ -1472,27 +1494,27 @@ pub enum Event {
1472
1494
/// returning `Err(ReplayEvent ())`) and won't be persisted across restarts.
1473
1495
///
1474
1496
/// [`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
1476
1498
/// [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels
1477
1499
OpenChannelRequest {
1478
1500
/// The temporary channel ID of the channel requested to be opened.
1479
1501
///
1480
1502
/// When responding to the request, the `temporary_channel_id` should be passed
1481
1503
/// 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.
1483
1505
///
1484
1506
/// [`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
1486
1508
temporary_channel_id : ChannelId ,
1487
1509
/// The node_id of the counterparty requesting to open the channel.
1488
1510
///
1489
1511
/// When responding to the request, the `counterparty_node_id` should be passed
1490
1512
/// 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.
1493
1515
///
1494
1516
/// [`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
1496
1518
counterparty_node_id : PublicKey ,
1497
1519
/// The channel value of the requested channel.
1498
1520
funding_satoshis : u64 ,
0 commit comments