lncli: remove debug send

Debug send has been removed some time ago. This is a left over.
This commit is contained in:
Joost Jager 2019-12-05 12:21:10 +01:00
parent af1b8a549d
commit 15eedd2b1a
No known key found for this signature in database
GPG Key ID: A61B9D4C393C59C7

@ -2144,12 +2144,6 @@ var sendPaymentCommand = cli.Command{
* --amt=A * --amt=A
* --final_cltv_delta=T * --final_cltv_delta=T
* --payment_hash=H * --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]", ArgsUsage: "dest amt payment_hash final_cltv_delta | --pay_req=[payment request]",
Flags: append(paymentFlags(), Flags: append(paymentFlags(),
@ -2166,10 +2160,6 @@ var sendPaymentCommand = cli.Command{
Name: "payment_hash, r", Name: "payment_hash, r",
Usage: "the hash to use within the payment's HTLC", 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{ cli.Int64Flag{
Name: "final_cltv_delta", Name: "final_cltv_delta",
Usage: "the number of blocks the last hop has to reveal the preimage", 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, Amt: amount,
} }
if ctx.Bool("debug_send") && (ctx.IsSet("payment_hash") || args.Present()) { var rHash []byte
return fmt.Errorf("do not provide a payment hash with debug send")
} else if !ctx.Bool("debug_send") {
var rHash []byte
switch { switch {
case ctx.IsSet("payment_hash"): case ctx.IsSet("payment_hash"):
rHash, err = hex.DecodeString(ctx.String("payment_hash")) rHash, err = hex.DecodeString(ctx.String("payment_hash"))
case args.Present(): case args.Present():
rHash, err = hex.DecodeString(args.First()) rHash, err = hex.DecodeString(args.First())
args = args.Tail() args = args.Tail()
default: default:
return fmt.Errorf("payment hash argument missing") 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 { if err != nil {
return err return err
} }
if len(rHash) != 32 { req.FinalCltvDelta = int32(delta)
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)
}
} }
return sendPaymentRequest(ctx, req) return sendPaymentRequest(ctx, req)