lncli: add i_know_what_i_am_doing flag to abandonchannel

This commit is contained in:
Oliver Gugger 2021-05-26 22:48:15 +02:00
parent 2e9dd0bcf2
commit 3b712bf722
No known key found for this signature in database
GPG Key ID: 8E4256593F177720

@ -1118,7 +1118,9 @@ var abandonChannelCommand = cli.Command{
summary. This method can be used to get rid of permanently unusable summary. This method can be used to get rid of permanently unusable
channels due to bugs fixed in newer versions of lnd. 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, To view which funding_txids/output_indexes can be used for this command,
see the channel_point values within the listchannels command output. 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 " + Usage: "the output index for the funding output of the funding " +
"transaction", "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), Action: actionDecorator(abandonChannel),
} }
@ -1155,7 +1167,8 @@ func abandonChannel(ctx *cli.Context) error {
} }
req := &lnrpc.AbandonChannelRequest{ req := &lnrpc.AbandonChannelRequest{
ChannelPoint: channelPoint, ChannelPoint: channelPoint,
IKnowWhatIAmDoing: ctx.Bool("i_know_what_i_am_doing"),
} }
resp, err := client.AbandonChannel(ctxc, req) resp, err := client.AbandonChannel(ctxc, req)