From 3b712bf7221f350c266b931355afe317febca1df Mon Sep 17 00:00:00 2001 From: Oliver Gugger Date: Wed, 26 May 2021 22:48:15 +0200 Subject: [PATCH] lncli: add i_know_what_i_am_doing flag to abandonchannel --- cmd/lncli/commands.go | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/cmd/lncli/commands.go b/cmd/lncli/commands.go index cde9e9fd..8e5f3fd8 100644 --- a/cmd/lncli/commands.go +++ b/cmd/lncli/commands.go @@ -1118,7 +1118,9 @@ var abandonChannelCommand = cli.Command{ summary. This method can be used to get rid of permanently unusable channels due to bugs fixed in newer versions of lnd. - Only available when lnd is built in debug mode. + Only available when lnd is built in debug mode. The flag + --i_know_what_im_doing can be set to override the debug/dev mode + requirement. To view which funding_txids/output_indexes can be used for this command, see the channel_point values within the listchannels command output. @@ -1134,6 +1136,16 @@ var abandonChannelCommand = cli.Command{ Usage: "the output index for the funding output of the funding " + "transaction", }, + cli.BoolFlag{ + Name: "i_know_what_i_am_doing", + Usage: "override the requirement for lnd needing to " + + "be in dev/debug mode to use this command; " + + "when setting this the user attests that " + + "they know the danger of using this command " + + "on channels and that doing so can lead to " + + "loss of funds if the channel funding TX " + + "ever confirms (or was confirmed)", + }, }, Action: actionDecorator(abandonChannel), } @@ -1155,7 +1167,8 @@ func abandonChannel(ctx *cli.Context) error { } req := &lnrpc.AbandonChannelRequest{ - ChannelPoint: channelPoint, + ChannelPoint: channelPoint, + IKnowWhatIAmDoing: ctx.Bool("i_know_what_i_am_doing"), } resp, err := client.AbandonChannel(ctxc, req)