Skip to content

Commit

Permalink
forceclose: factor out warnings to a const
Browse files Browse the repository at this point in the history
It will be reused in scbforceclose.
  • Loading branch information
starius committed Jul 7, 2024
1 parent d872f10 commit dbcbcae
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions cmd/chantools/forceclose.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 \
Expand Down

0 comments on commit dbcbcae

Please sign in to comment.