cmd: add static address warning

This commit is contained in:
Slyghtning 2024-12-11 12:12:32 +01:00
parent c9068ac1ca
commit b25b451c42
No known key found for this signature in database
GPG key ID: F82D456EA023C9BF

View file

@ -60,6 +60,11 @@ func newStaticAddress(ctx *cli.Context) error {
return cli.ShowCommandHelp(ctx, "new")
}
err := displayNewAddressWarning()
if err != nil {
return err
}
client, cleanup, err := getClient(ctx)
if err != nil {
return err
@ -636,3 +641,23 @@ func depositsToOutpoints(deposits []*looprpc.Deposit) []string {
return outpoints
}
func displayNewAddressWarning() error {
fmt.Printf("\nWARNING: Be aware that loosing your l402.token file in " +
".loop under your home directory \nwill take your ability to " +
"spend funds sent to the static address via loop-ins or " +
"\nwithdrawals. You will have to wait until the deposit " +
"expires and your loop client \nsweeps the funds back to your " +
"lnd wallet. The deposit expiry could be months in the " +
"future.\n")
fmt.Printf("\nCONTINUE WITH NEW ADDRESS? (y/n): ")
var answer string
fmt.Scanln(&answer)
if answer == "y" {
return nil
}
return errors.New("new address creation canceled")
}