Skip to content

Commit 5ccb9db

Browse files
authored
Merge pull request #8526 from guggero/confirm-closeallchannels
cli: add confirmation prompt to closeallchannels
2 parents 716c6dd + bb5b614 commit 5ccb9db

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

cmd/lncli/commands.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -994,6 +994,11 @@ var closeAllChannelsCommand = cli.Command{
994994
"sat/vbyte that should be used when crafting " +
995995
"the closing transactions",
996996
},
997+
cli.BoolFlag{
998+
Name: "s, skip_confirmation",
999+
Usage: "Skip the confirmation prompt and close all " +
1000+
"channels immediately",
1001+
},
9971002
},
9981003
Action: actionDecorator(closeAllChannels),
9991004
}
@@ -1012,6 +1017,11 @@ func closeAllChannels(ctx *cli.Context) error {
10121017
return err
10131018
}
10141019

1020+
prompt := "Do you really want to close ALL channels? (yes/no): "
1021+
if !ctx.Bool("skip_confirmation") && !promptForConfirmation(prompt) {
1022+
return errors.New("action aborted by user")
1023+
}
1024+
10151025
listReq := &lnrpc.ListChannelsRequest{}
10161026
openChannels, err := client.ListChannels(ctxc, listReq)
10171027
if err != nil {

docs/release-notes/release-notes-0.18.0.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,9 @@
191191
[Deprecate bumpclosefee for bumpforceclosefee and add `max_fee_rate` option
192192
to `closechannel` cmd](https://github.com/lightningnetwork/lnd/pull/8350).
193193

194+
* The [`closeallchannels` command now asks for confirmation before closing
195+
all channels](https://github.com/lightningnetwork/lnd/pull/8526).
196+
194197
# Improvements
195198
## Functional Updates
196199
### Tlv

0 commit comments

Comments
 (0)