mirror of
https://github.com/aljazceru/breez-lnd.git
synced 2025-12-19 15:14:22 +01:00
cmd/lncli: add validation of address for connectpeer
This commit is contained in:
@@ -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],
|
||||||
|
|||||||
Reference in New Issue
Block a user