diff --git a/crates/ln-dlc-node/src/ln/dlc_channel_details.rs b/crates/ln-dlc-node/src/ln/dlc_channel_details.rs index 54ee32048..edb22b3e3 100644 --- a/crates/ln-dlc-node/src/ln/dlc_channel_details.rs +++ b/crates/ln-dlc-node/src/ln/dlc_channel_details.rs @@ -75,6 +75,23 @@ impl From for DlcChannelDetails { Some(fund_tx.txid().to_string()), Some(fund_output_index), Some(close_tx.txid().to_string())), + Channel::Signed(SignedChannel { + update_idx, + fee_rate_per_vb, + fund_tx, + fund_output_index, + state: dlc_manager::channel::signed_channel::SignedChannelState::SettledClosing { + settle_transaction, + .. + }, + .. + }) => ( + Some(update_idx), + Some(SignedChannelState::SettledClosing), + Some(fee_rate_per_vb), + Some(fund_tx.txid().to_string()), + Some(fund_output_index), + Some(settle_transaction.txid().to_string())), Channel::Signed(signed_channel) => ( Some(signed_channel.update_idx), Some(SignedChannelState::from(signed_channel.state)), diff --git a/mobile/lib/common/dlc_channel_change_notifier.dart b/mobile/lib/common/dlc_channel_change_notifier.dart index 6cc9a5b8c..900f02c8b 100644 --- a/mobile/lib/common/dlc_channel_change_notifier.dart +++ b/mobile/lib/common/dlc_channel_change_notifier.dart @@ -64,6 +64,13 @@ class DlcChannelChangeNotifier extends ChangeNotifier { .toList(); } + List getAllSettledClosingDlcChannels() { + return channels + .where((channel) => channel.state == ChannelState.settledClosing) + .map((channel) => channel as SettledClosingDlcChannel) + .toList(); + } + List getAllClosedDlcChannels() { return channels .where((channel) => [ diff --git a/mobile/lib/common/domain/dlc_channel.dart b/mobile/lib/common/domain/dlc_channel.dart index 53892445b..cb23303f6 100644 --- a/mobile/lib/common/domain/dlc_channel.dart +++ b/mobile/lib/common/domain/dlc_channel.dart @@ -50,7 +50,7 @@ class DlcChannel { { return SettledClosingDlcChannel( id: dlcChannel.dlcChannelId, - state: ChannelState.closing, + state: ChannelState.settledClosing, settleTxid: closing.settleTxid, ); } @@ -182,6 +182,7 @@ enum ChannelState { accepted, signed, closing, + settledClosing, closed, counterClosed, closedPunished, @@ -201,6 +202,8 @@ enum ChannelState { return "Signed"; case ChannelState.closing: return "Closing"; + case ChannelState.settledClosing: + return "Settled Closing"; case ChannelState.closed: return "Closed"; case ChannelState.counterClosed: diff --git a/mobile/lib/common/settings/channel_screen.dart b/mobile/lib/common/settings/channel_screen.dart index 70513e17a..4cba7d20b 100644 --- a/mobile/lib/common/settings/channel_screen.dart +++ b/mobile/lib/common/settings/channel_screen.dart @@ -46,6 +46,7 @@ class _ChannelScreenState extends State { ...dlcChannelChangeNotifier.getAllAcceptedDlcChannels(), ...dlcChannelChangeNotifier.getAllCancelledDlcChannels(), ...dlcChannelChangeNotifier.getAllClosingDlcChannels(), + ...dlcChannelChangeNotifier.getAllSettledClosingDlcChannels(), ...dlcChannelChangeNotifier.getAllClosedDlcChannels(), ...dlcChannelChangeNotifier.getAllOtherDlcChannels() ]; @@ -223,6 +224,11 @@ class ChannelsTile extends StatelessWidget { leading: const Text('Buffer TXID', style: TextStyle(fontSize: 17)), title: TransactionIdText(channel.bufferTxid)) : Container(), + channel is SettledClosingDlcChannel + ? ListTile( + leading: const Text('Settle TXID', style: TextStyle(fontSize: 17)), + title: TransactionIdText(channel.settleTxid)) + : Container(), channel is ClosedDlcChannel ? ListTile( leading: const Text('Closing TXID', style: TextStyle(fontSize: 17)), diff --git a/mobile/native/src/dlc_channel.rs b/mobile/native/src/dlc_channel.rs index 6f86d5a19..8510e15e5 100644 --- a/mobile/native/src/dlc_channel.rs +++ b/mobile/native/src/dlc_channel.rs @@ -32,6 +32,21 @@ impl From<&Channel> for DlcChannel { closing_txid: Some(close_tx.txid().to_string()), state: SignedChannelState::CollaborativeCloseOffered, }, + s @ Channel::Signed(SignedChannel { + state: dlc_manager::channel::signed_channel::SignedChannelState::SettledClosing { + settle_transaction, + .. + }, + fund_tx, + fund_output_index, + .. + }) => ChannelState::Signed { + contract_id: s.get_contract_id().map(hex::encode), + funding_txid: fund_tx.txid().to_string(), + funding_tx_vout: *fund_output_index, + closing_txid: Some(settle_transaction.txid().to_string()), + state: SignedChannelState::SettledClosing, + }, Channel::Signed(s) => ChannelState::Signed { contract_id: s.get_contract_id().map(hex::encode), funding_txid: s.fund_tx.txid().to_string(), diff --git a/webapp/frontend/lib/settings/channel_screen.dart b/webapp/frontend/lib/settings/channel_screen.dart index e80fe10a0..e9557206d 100644 --- a/webapp/frontend/lib/settings/channel_screen.dart +++ b/webapp/frontend/lib/settings/channel_screen.dart @@ -146,6 +146,7 @@ class _ChannelDetailWidgetState extends State { buildCopyableTxId(context, "Funding TxId", widget.channel.fundTxid), buildCopyableTxId(context, "Buffer TxId", widget.channel.bufferTxid), buildCopyableTxId(context, "Close TxId", widget.channel.closeTxid), + buildCopyableTxId(context, "Settle TxId", widget.channel.settleTxid), Visibility( visible: widget.channel.channelState == ChannelState.signed && widget.channel.signedChannelState != null && diff --git a/webapp/src/api.rs b/webapp/src/api.rs index 5a7b30f95..30422751e 100644 --- a/webapp/src/api.rs +++ b/webapp/src/api.rs @@ -634,9 +634,9 @@ impl From<&dlc_manager::channel::Channel> for DlcChannel { settle_transaction, .. } => ( SignedChannelState::Closing, - None, Some(settle_transaction), None, + None, ), dlc_manager::channel::signed_channel::SignedChannelState::CollaborativeCloseOffered { close_tx, .. } => ( SignedChannelState::CollaborativeCloseOffered,