From 1564ed9141d531aa9a88fcd36603d7013bcc2b38 Mon Sep 17 00:00:00 2001 From: Lucas Soriano del Pino Date: Mon, 29 Jan 2024 18:34:54 +1100 Subject: [PATCH] feat(coordinator): Allow collab-closing Lightning channels --- coordinator/src/admin.rs | 12 +++++++++--- coordinator/src/routes.rs | 4 ++-- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/coordinator/src/admin.rs b/coordinator/src/admin.rs index 80d3f7136..74f8ded4a 100644 --- a/coordinator/src/admin.rs +++ b/coordinator/src/admin.rs @@ -602,16 +602,22 @@ pub async fn delete_dlc_channels( } #[instrument(skip_all, err(Debug))] -pub async fn force_close_ln_dlc_channel( +pub async fn close_ln_dlc_channel( Path(channel_id_string): Path, + Query(params): Query, State(state): State>, ) -> Result<(), AppError> { let channel_id = parse_channel_id(&channel_id_string) .map_err(|_| AppError::BadRequest("Provided channel ID was invalid".to_string()))?; - tracing::info!(channel_id = %channel_id_string, "Attempting to force-close Lightning channel"); + let is_force_close = params.force.unwrap_or(false); + + tracing::info!( + channel_id = %channel_id_string, + %is_force_close, + "Attempting to close an LN-DLC channel" + ); - let is_force_close = true; state .node .inner diff --git a/coordinator/src/routes.rs b/coordinator/src/routes.rs index be4060de4..ad735f267 100644 --- a/coordinator/src/routes.rs +++ b/coordinator/src/routes.rs @@ -1,8 +1,8 @@ use crate::admin::close_channel; +use crate::admin::close_ln_dlc_channel; use crate::admin::collaborative_revert; use crate::admin::connect_to_peer; use crate::admin::delete_dlc_channels; -use crate::admin::force_close_ln_dlc_channel; use crate::admin::get_balance; use crate::admin::get_fee_rate_estimation; use crate::admin::get_utxos; @@ -160,7 +160,7 @@ pub fn router( .route("/api/admin/channels/:channel_id", delete(close_channel)) .route( "/api/admin/ln-dlc-channels/:channel_id", - delete(force_close_ln_dlc_channel), + delete(close_ln_dlc_channel), ) .route("/api/admin/peers", get(list_peers)) .route("/api/admin/send_payment/:invoice", post(send_payment))