Skip to content

Commit

Permalink
Merge pull request #8526 from guggero/confirm-closeallchannels
Browse files Browse the repository at this point in the history
cli: add confirmation prompt to closeallchannels
  • Loading branch information
guggero committed Mar 7, 2024
2 parents 716c6dd + bb5b614 commit 5ccb9db
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
10 changes: 10 additions & 0 deletions cmd/lncli/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -994,6 +994,11 @@ var closeAllChannelsCommand = cli.Command{
"sat/vbyte that should be used when crafting " +
"the closing transactions",
},
cli.BoolFlag{
Name: "s, skip_confirmation",
Usage: "Skip the confirmation prompt and close all " +
"channels immediately",
},
},
Action: actionDecorator(closeAllChannels),
}
Expand All @@ -1012,6 +1017,11 @@ func closeAllChannels(ctx *cli.Context) error {
return err
}

prompt := "Do you really want to close ALL channels? (yes/no): "
if !ctx.Bool("skip_confirmation") && !promptForConfirmation(prompt) {
return errors.New("action aborted by user")
}

listReq := &lnrpc.ListChannelsRequest{}
openChannels, err := client.ListChannels(ctxc, listReq)
if err != nil {
Expand Down
3 changes: 3 additions & 0 deletions docs/release-notes/release-notes-0.18.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,9 @@
[Deprecate bumpclosefee for bumpforceclosefee and add `max_fee_rate` option
to `closechannel` cmd](https://github.com/lightningnetwork/lnd/pull/8350).

* The [`closeallchannels` command now asks for confirmation before closing
all channels](https://github.com/lightningnetwork/lnd/pull/8526).

# Improvements
## Functional Updates
### Tlv
Expand Down

0 comments on commit 5ccb9db

Please sign in to comment.