From 15eedd2b1a3d07b7b9f387b68fee0792a853407e Mon Sep 17 00:00:00 2001 From: Joost Jager Date: Thu, 5 Dec 2019 12:21:10 +0100 Subject: [PATCH] lncli: remove debug send Debug send has been removed some time ago. This is a left over. --- cmd/lncli/commands.go | 64 +++++++++++++++++-------------------------- 1 file changed, 25 insertions(+), 39 deletions(-) diff --git a/cmd/lncli/commands.go b/cmd/lncli/commands.go index 9a0cfd74..2346672f 100644 --- a/cmd/lncli/commands.go +++ b/cmd/lncli/commands.go @@ -2144,12 +2144,6 @@ var sendPaymentCommand = cli.Command{ * --amt=A * --final_cltv_delta=T * --payment_hash=H - - The --debug_send flag is provided for usage *purely* in test - environments. If specified, then the payment hash isn't required, as - it'll use the hash of all zeroes. This mode allows one to quickly test - payment connectivity without having to create an invoice at the - destination. `, ArgsUsage: "dest amt payment_hash final_cltv_delta | --pay_req=[payment request]", Flags: append(paymentFlags(), @@ -2166,10 +2160,6 @@ var sendPaymentCommand = cli.Command{ Name: "payment_hash, r", Usage: "the hash to use within the payment's HTLC", }, - cli.BoolFlag{ - Name: "debug_send", - Usage: "use the debug rHash when sending the HTLC", - }, cli.Int64Flag{ Name: "final_cltv_delta", Usage: "the number of blocks the last hop has to reveal the preimage", @@ -2276,40 +2266,36 @@ func sendPayment(ctx *cli.Context) error { Amt: amount, } - if ctx.Bool("debug_send") && (ctx.IsSet("payment_hash") || args.Present()) { - return fmt.Errorf("do not provide a payment hash with debug send") - } else if !ctx.Bool("debug_send") { - var rHash []byte + var rHash []byte - switch { - case ctx.IsSet("payment_hash"): - rHash, err = hex.DecodeString(ctx.String("payment_hash")) - case args.Present(): - rHash, err = hex.DecodeString(args.First()) - args = args.Tail() - default: - return fmt.Errorf("payment hash argument missing") - } + switch { + case ctx.IsSet("payment_hash"): + rHash, err = hex.DecodeString(ctx.String("payment_hash")) + case args.Present(): + rHash, err = hex.DecodeString(args.First()) + args = args.Tail() + default: + return fmt.Errorf("payment hash argument missing") + } + if err != nil { + return err + } + if len(rHash) != 32 { + return fmt.Errorf("payment hash must be exactly 32 "+ + "bytes, is instead %v", len(rHash)) + } + req.PaymentHash = rHash + + switch { + case ctx.IsSet("final_cltv_delta"): + req.FinalCltvDelta = int32(ctx.Int64("final_cltv_delta")) + case args.Present(): + delta, err := strconv.ParseInt(args.First(), 10, 64) if err != nil { return err } - if len(rHash) != 32 { - return fmt.Errorf("payment hash must be exactly 32 "+ - "bytes, is instead %v", len(rHash)) - } - req.PaymentHash = rHash - - switch { - case ctx.IsSet("final_cltv_delta"): - req.FinalCltvDelta = int32(ctx.Int64("final_cltv_delta")) - case args.Present(): - delta, err := strconv.ParseInt(args.First(), 10, 64) - if err != nil { - return err - } - req.FinalCltvDelta = int32(delta) - } + req.FinalCltvDelta = int32(delta) } return sendPaymentRequest(ctx, req)