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:
Olaoluwa Osuntokun 2016-09-20 16:19:15 -07:00
parent 89310c8778
commit d34b90136f
No known key found for this signature in database
GPG Key ID: 9CC5B105D03521A2

@ -516,7 +516,8 @@ var SendPaymentCommand = cli.Command{
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{