cmd/lncli: add validation of address for connectpeer
This commit is contained in:
parent
a14246c5bb
commit
14aadc8c2e
@ -152,6 +152,10 @@ func connectPeer(ctx *cli.Context) error {
|
|||||||
|
|
||||||
targetAddress := ctx.Args().Get(0)
|
targetAddress := ctx.Args().Get(0)
|
||||||
splitAddr := strings.Split(targetAddress, "@")
|
splitAddr := strings.Split(targetAddress, "@")
|
||||||
|
if len(splitAddr) != 2 {
|
||||||
|
return fmt.Errorf("target address expected in format: lnid@host:port")
|
||||||
|
}
|
||||||
|
|
||||||
addr := &lnrpc.LightningAddress{
|
addr := &lnrpc.LightningAddress{
|
||||||
PubKeyHash: splitAddr[0],
|
PubKeyHash: splitAddr[0],
|
||||||
Host: splitAddr[1],
|
Host: splitAddr[1],
|
||||||
|
Loading…
Reference in New Issue
Block a user