cmd/lncli: add new --debug_send option to sendpayment
This commit adds a new option to the send payment command. The new option toggles usage of the debug HTLC R-Hash when sending the described payment. This flag should be used in conjunction with lnd nodes that have been started with the `—debughtlc` flag in order to allow sending payments without first registering invoices.
This commit is contained in:
parent
7310d0a0f7
commit
89310c8778
@ -526,6 +526,10 @@ 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.BoolFlag{
|
cli.BoolFlag{
|
||||||
Name: "fast, f",
|
Name: "fast, f",
|
||||||
Usage: "skip the HTLC trickle logic, immediately creating a " +
|
Usage: "skip the HTLC trickle logic, immediately creating a " +
|
||||||
@ -553,10 +557,21 @@ func sendPaymentCommand(ctx *cli.Context) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
req := &lnrpc.SendRequest{
|
req := &lnrpc.SendRequest{
|
||||||
Dest: destAddr,
|
Dest: destNode,
|
||||||
Amt: int64(ctx.Int("amt")),
|
Amt: int64(ctx.Int("amt")),
|
||||||
PaymentHash: rHash[:],
|
FastSend: ctx.Bool("fast"),
|
||||||
FastSend: ctx.Bool("fast"),
|
}
|
||||||
|
|
||||||
|
if !ctx.Bool("debug_send") {
|
||||||
|
rHash, err := hex.DecodeString(ctx.String("payment_hash"))
|
||||||
|
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
|
||||||
}
|
}
|
||||||
|
|
||||||
paymentStream, err := client.SendPayment(context.Background())
|
paymentStream, err := client.SendPayment(context.Background())
|
||||||
|
Loading…
Reference in New Issue
Block a user