Skip to content

Commit cdb0ddf

Browse files
Refactor CloseChannel API to remove force close functionality
1 parent 0e18aa7 commit cdb0ddf

File tree

3 files changed

+4
-30
lines changed

3 files changed

+4
-30
lines changed

ldk-server-protos/src/api.rs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -270,9 +270,7 @@ pub struct UpdateChannelConfigRequest {
270270
#[derive(Clone, PartialEq, ::prost::Message)]
271271
pub struct UpdateChannelConfigResponse {}
272272
/// Closes the channel specified by given request.
273-
/// See more:
274-
/// - <https://docs.rs/ldk-node/latest/ldk_node/struct.Node.html#method.close_channel>
275-
/// - <https://docs.rs/ldk-node/latest/ldk_node/struct.Node.html#method.force_close_channel>
273+
/// See more: <https://docs.rs/ldk-node/latest/ldk_node/struct.Node.html#method.close_channel>
276274
#[allow(clippy::derive_partial_eq_without_eq)]
277275
#[derive(Clone, PartialEq, ::prost::Message)]
278276
pub struct CloseChannelRequest {
@@ -282,12 +280,6 @@ pub struct CloseChannelRequest {
282280
/// The hex-encoded public key of the node to close a channel with.
283281
#[prost(string, tag = "2")]
284282
pub counterparty_node_id: ::prost::alloc::string::String,
285-
/// Whether to force close the specified channel.
286-
#[prost(bool, optional, tag = "3")]
287-
pub force_close: ::core::option::Option<bool>,
288-
/// The reason for force-closing, can only be set while force closing a channel.
289-
#[prost(string, optional, tag = "4")]
290-
pub force_close_reason: ::core::option::Option<::prost::alloc::string::String>,
291283
}
292284
/// The response `content` for the `CloseChannel` API, when HttpStatusCode is OK (200).
293285
/// When HttpStatusCode is not OK (non-200), the response `content` contains a serialized `ErrorResponse`.

ldk-server-protos/src/proto/api.proto

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -261,29 +261,19 @@ message UpdateChannelConfigResponse {
261261
}
262262

263263
// Closes the channel specified by given request.
264-
// See more:
265-
// - https://docs.rs/ldk-node/latest/ldk_node/struct.Node.html#method.close_channel
266-
// - https://docs.rs/ldk-node/latest/ldk_node/struct.Node.html#method.force_close_channel
264+
// See more: https://docs.rs/ldk-node/latest/ldk_node/struct.Node.html#method.close_channel
267265
message CloseChannelRequest {
268266

269267
// The local `user_channel_id` of this channel.
270268
string user_channel_id = 1;
271269

272270
// The hex-encoded public key of the node to close a channel with.
273271
string counterparty_node_id = 2;
274-
275-
// Whether to force close the specified channel.
276-
optional bool force_close = 3;
277-
278-
// The reason for force-closing, can only be set while force closing a channel.
279-
optional string force_close_reason = 4;
280272
}
281273

282274
// The response `content` for the `CloseChannel` API, when HttpStatusCode is OK (200).
283275
// When HttpStatusCode is not OK (non-200), the response `content` contains a serialized `ErrorResponse`.
284-
message CloseChannelResponse {
285-
286-
}
276+
message CloseChannelResponse {}
287277

288278
// Returns a list of known channels.
289279
// See more: https://docs.rs/ldk-node/latest/ldk_node/struct.Node.html#method.list_channels

ldk-server/src/api/close_channel.rs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,7 @@ pub(crate) fn handle_close_channel_request(
2121
format!("Invalid counterparty node ID, error: {}", e),
2222
)
2323
})?;
24-
25-
match request.force_close {
26-
Some(true) => context.node.force_close_channel(
27-
&user_channel_id,
28-
counterparty_node_id,
29-
request.force_close_reason,
30-
)?,
31-
_ => context.node.close_channel(&user_channel_id, counterparty_node_id)?,
32-
};
24+
context.node.close_channel(&user_channel_id, counterparty_node_id)?;
3325

3426
let response = CloseChannelResponse {};
3527
Ok(response)

0 commit comments

Comments
 (0)