From 92ae54d7ae41e71cff8386a7a0a3993645ee80b2 Mon Sep 17 00:00:00 2001 From: Oliver Gugger Date: Wed, 6 Mar 2024 17:35:33 +0100 Subject: [PATCH 1/2] 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. --- cmd/lncli/commands.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/cmd/lncli/commands.go b/cmd/lncli/commands.go index cc8efc5f0..5190cd69f 100644 --- a/cmd/lncli/commands.go +++ b/cmd/lncli/commands.go @@ -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 { From bb5b614af55055bb12d0abeb6afde33ccdb32725 Mon Sep 17 00:00:00 2001 From: Oliver Gugger Date: Wed, 6 Mar 2024 17:37:25 +0100 Subject: [PATCH 2/2] docs: add release notes --- docs/release-notes/release-notes-0.18.0.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/release-notes/release-notes-0.18.0.md b/docs/release-notes/release-notes-0.18.0.md index a601123cf..95c6fc80a 100644 --- a/docs/release-notes/release-notes-0.18.0.md +++ b/docs/release-notes/release-notes-0.18.0.md @@ -188,6 +188,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