File tree Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -271,6 +271,11 @@ pub(crate) fn poll_for_user_input(node: &LightningNode, log_file_path: &str) {
271
271
"background" => {
272
272
node. background ( ) ;
273
273
}
274
+ "closechannels" => {
275
+ if let Err ( message) = node. close_all_channels_with_current_lsp ( ) {
276
+ println ! ( "{}" , format!( "{message:#}" ) . red( ) ) ;
277
+ }
278
+ }
274
279
"stop" => {
275
280
break ;
276
281
}
@@ -412,6 +417,7 @@ fn setup_editor(history_path: &Path) -> Editor<CommandHinter, DefaultHistory> {
412
417
hints. insert ( CommandHint :: new ( "health" , "health" ) ) ;
413
418
hints. insert ( CommandHint :: new ( "foreground" , "foreground" ) ) ;
414
419
hints. insert ( CommandHint :: new ( "background" , "background" ) ) ;
420
+ hints. insert ( CommandHint :: new ( "closechannels" , "closechannels" ) ) ;
415
421
hints. insert ( CommandHint :: new ( "stop" , "stop" ) ) ;
416
422
hints. insert ( CommandHint :: new ( "help" , "help" ) ) ;
417
423
hints. insert ( CommandHint :: new ( "h" , "h" ) ) ;
@@ -475,6 +481,8 @@ fn help() {
475
481
println ! ( " foreground" ) ;
476
482
println ! ( " background" ) ;
477
483
println ! ( ) ;
484
+ println ! ( " closechannels" ) ;
485
+ println ! ( ) ;
478
486
println ! ( " stop" ) ;
479
487
}
480
488
Original file line number Diff line number Diff line change @@ -2436,6 +2436,19 @@ impl LightningNode {
2436
2436
2437
2437
Ok ( node_state. utxos )
2438
2438
}
2439
+
2440
+ // Only meant for example CLI use
2441
+ #[ doc( hidden) ]
2442
+ pub fn close_all_channels_with_current_lsp ( & self ) -> Result < ( ) > {
2443
+ self . rt
2444
+ . handle ( )
2445
+ . block_on ( self . sdk . close_lsp_channels ( ) )
2446
+ . map_to_runtime_error (
2447
+ RuntimeErrorCode :: NodeUnavailable ,
2448
+ "Failed to close channels" ,
2449
+ ) ?;
2450
+ Ok ( ( ) )
2451
+ }
2439
2452
}
2440
2453
2441
2454
pub ( crate ) async fn start_sdk (
You can’t perform that action at this time.
0 commit comments