cmd/lncli: add validation of address for connectpeer

This commit is contained in:
Olaoluwa Osuntokun 2016-07-16 17:43:27 -07:00
parent a14246c5bb
commit 14aadc8c2e
No known key found for this signature in database
GPG Key ID: 9CC5B105D03521A2

View File

@ -152,6 +152,10 @@ func connectPeer(ctx *cli.Context) error {
targetAddress := ctx.Args().Get(0)
splitAddr := strings.Split(targetAddress, "@")
if len(splitAddr) != 2 {
return fmt.Errorf("target address expected in format: lnid@host:port")
}
addr := &lnrpc.LightningAddress{
PubKeyHash: splitAddr[0],
Host: splitAddr[1],