cmd/lncli: the target destination for sendpayment must now be a compressed pubkey
This commit modifies the sendpayment message slightly to indicate that the —dest value should be a hex-encoded compressed public key. This change is required to stream line the integration of onion routing into the daemon.
This commit is contained in:
parent
89310c8778
commit
d34b90136f
@ -515,8 +515,9 @@ var SendPaymentCommand = cli.Command{
|
|||||||
Usage: "sendpayment --dest=[node_id] --amt=[in_satoshis]",
|
Usage: "sendpayment --dest=[node_id] --amt=[in_satoshis]",
|
||||||
Flags: []cli.Flag{
|
Flags: []cli.Flag{
|
||||||
cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "dest, d",
|
Name: "dest, d",
|
||||||
Usage: "lightning address of the payment recipient",
|
Usage: "the compressed identity pubkey of the " +
|
||||||
|
"payment recipient",
|
||||||
},
|
},
|
||||||
cli.IntFlag{ // TODO(roasbeef): float64?
|
cli.IntFlag{ // TODO(roasbeef): float64?
|
||||||
Name: "amt, a",
|
Name: "amt, a",
|
||||||
@ -542,18 +543,13 @@ var SendPaymentCommand = cli.Command{
|
|||||||
func sendPaymentCommand(ctx *cli.Context) error {
|
func sendPaymentCommand(ctx *cli.Context) error {
|
||||||
client := getClient(ctx)
|
client := getClient(ctx)
|
||||||
|
|
||||||
destAddr, err := hex.DecodeString(ctx.String("dest"))
|
destNode, err := hex.DecodeString(ctx.String("dest"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
if len(destNode) != 33 {
|
||||||
rHash, err := hex.DecodeString(ctx.String("payment_hash"))
|
return fmt.Errorf("dest node pubkey must be exactly 33 bytes, is "+
|
||||||
if err != nil {
|
"instead: %v", len(destNode))
|
||||||
return err
|
|
||||||
}
|
|
||||||
if len(rHash) != 32 {
|
|
||||||
return fmt.Errorf("payment hash must be exactly 32 bytes, is "+
|
|
||||||
"instead %v", len(rHash))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
req := &lnrpc.SendRequest{
|
req := &lnrpc.SendRequest{
|
||||||
|
Loading…
Reference in New Issue
Block a user