mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-03-04 17:55:36 +01:00
cmd/lncli: add confirmation promt to closeallchannels
To make sure users don't accidentally close all channels, we ask before running this potentially very destructive command.
This commit is contained in:
parent
5f89a8b832
commit
92ae54d7ae
1 changed files with 10 additions and 0 deletions
|
@ -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),
|
||||
}
|
||||
|
@ -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 {
|
||||
|
|
Loading…
Add table
Reference in a new issue