Merge pull request #8526 from guggero/confirm-closeallchannels

cli: add confirmation prompt to closeallchannels
This commit is contained in:
Oliver Gugger 2024-03-07 02:31:46 -06:00 committed by GitHub
commit 5ccb9db78f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 13 additions and 0 deletions

View File

@ -994,6 +994,11 @@ var closeAllChannelsCommand = cli.Command{
"sat/vbyte that should be used when crafting " + "sat/vbyte that should be used when crafting " +
"the closing transactions", "the closing transactions",
}, },
cli.BoolFlag{
Name: "s, skip_confirmation",
Usage: "Skip the confirmation prompt and close all " +
"channels immediately",
},
}, },
Action: actionDecorator(closeAllChannels), Action: actionDecorator(closeAllChannels),
} }
@ -1012,6 +1017,11 @@ func closeAllChannels(ctx *cli.Context) error {
return err 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{} listReq := &lnrpc.ListChannelsRequest{}
openChannels, err := client.ListChannels(ctxc, listReq) openChannels, err := client.ListChannels(ctxc, listReq)
if err != nil { if err != nil {

View File

@ -191,6 +191,9 @@
[Deprecate bumpclosefee for bumpforceclosefee and add `max_fee_rate` option [Deprecate bumpclosefee for bumpforceclosefee and add `max_fee_rate` option
to `closechannel` cmd](https://github.com/lightningnetwork/lnd/pull/8350). 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 # Improvements
## Functional Updates ## Functional Updates
### Tlv ### Tlv