From b9d6c667e7b04023bdbd3bbc2183f74a96c5d83e Mon Sep 17 00:00:00 2001 From: Boris Nagaev Date: Sat, 30 Dec 2023 11:42:05 -0300 Subject: [PATCH] forceclose: factor out warnings to a const It will be reused in scbforceclose. --- cmd/chantools/forceclose.go | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/cmd/chantools/forceclose.go b/cmd/chantools/forceclose.go index 90ea393..af96ecd 100644 --- a/cmd/chantools/forceclose.go +++ b/cmd/chantools/forceclose.go @@ -19,6 +19,20 @@ import ( "github.com/spf13/cobra" ) +const forceCloseWarning = ` +If you are certain that a node is offline for good (AFTER you've tried SCB!) +and a channel is still open, you can use this method to force-close your +latest state that you have in your channel.db. + +**!!! WARNING !!! DANGER !!! WARNING !!!** + +If you do this and the state that you publish is *not* the latest state, then +the remote node *could* punish you by taking the whole channel amount *if* they +come online before you can sweep the funds from the time locked (144 - 2000 +blocks) transaction *or* they have a watch tower looking out for them. + +**This should absolutely be the last resort and you have been warned!**` + type forceCloseCommand struct { APIURL string ChannelDB string @@ -35,18 +49,7 @@ func newForceCloseCommand() *cobra.Command { Use: "forceclose", Short: "Force-close the last state that is in the channel.db " + "provided", - Long: `If you are certain that a node is offline for good (AFTER -you've tried SCB!) and a channel is still open, you can use this method to -force-close your latest state that you have in your channel.db. - -**!!! WARNING !!! DANGER !!! WARNING !!!** - -If you do this and the state that you publish is *not* the latest state, then -the remote node *could* punish you by taking the whole channel amount *if* they -come online before you can sweep the funds from the time locked (144 - 2000 -blocks) transaction *or* they have a watch tower looking out for them. - -**This should absolutely be the last resort and you have been warned!**`, + Long: forceCloseWarning, Example: `chantools forceclose \ --fromsummary results/summary-xxxx-yyyy.json --channeldb ~/.lnd/data/graph/mainnet/channel.db \