File tree 2 files changed +12
-14
lines changed
2 files changed +12
-14
lines changed Original file line number Diff line number Diff line change @@ -61,21 +61,19 @@ pub struct DlcChannel {
61
61
}
62
62
63
63
impl Node {
64
- pub async fn close_dlc_channel (
65
- & self ,
66
- channel_id : DlcChannelId ,
67
- is_force_close : bool ,
68
- ) -> Result < ( ) > {
64
+ pub async fn force_close_dlc_channel ( & self , channel_id : DlcChannelId ) -> Result < ( ) > {
65
+ self . inner . close_dlc_channel ( channel_id, true ) . await ?;
66
+ Ok ( ( ) )
67
+ }
68
+
69
+ pub async fn close_dlc_channel ( & self , channel_id : DlcChannelId ) -> Result < ( ) > {
69
70
let channel = self . inner . get_dlc_channel_by_id ( & channel_id) ?;
70
71
let previous_id = channel
71
72
. get_reference_id ( )
72
73
. map ( ProtocolId :: try_from)
73
74
. transpose ( ) ?;
74
75
75
- let protocol_id = self
76
- . inner
77
- . close_dlc_channel ( channel_id, is_force_close)
78
- . await ?;
76
+ let protocol_id = self . inner . close_dlc_channel ( channel_id, false ) . await ?;
79
77
80
78
let protocol_executor = dlc_protocol:: DlcProtocolExecutor :: new ( self . pool . clone ( ) ) ;
81
79
protocol_executor. start_dlc_protocol (
Original file line number Diff line number Diff line change @@ -296,11 +296,11 @@ pub async fn close_channel(
296
296
297
297
tracing:: info!( channel_id = %channel_id_string, "Attempting to close channel" ) ;
298
298
299
- state
300
- . node
301
- . close_dlc_channel ( channel_id , params . force . unwrap_or_default ( ) )
302
- . await
303
- . map_err ( |e| AppError :: InternalServerError ( format ! ( "{e:#}" ) ) ) ?;
299
+ match params . force . unwrap_or_default ( ) {
300
+ true => state . node . force_close_dlc_channel ( channel_id ) . await ,
301
+ false => state . node . close_dlc_channel ( channel_id ) . await ,
302
+ }
303
+ . map_err ( |e| AppError :: InternalServerError ( format ! ( "{e:#}" ) ) ) ?;
304
304
305
305
Ok ( ( ) )
306
306
}
You can’t perform that action at this time.
0 commit comments