From 7642bad54fb517fbcc51e066f317e0462ddeb670 Mon Sep 17 00:00:00 2001 From: Wilmer Paulino Date: Tue, 13 Mar 2018 15:11:25 -0400 Subject: [PATCH] cmd/lncli: add flags to listchannels to retrieve specific channels --- cmd/lncli/commands.go | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/cmd/lncli/commands.go b/cmd/lncli/commands.go index e618692a..78a7a99d 100644 --- a/cmd/lncli/commands.go +++ b/cmd/lncli/commands.go @@ -1385,9 +1385,21 @@ var listChannelsCommand = cli.Command{ Usage: "List all open channels", Flags: []cli.Flag{ cli.BoolFlag{ - Name: "active_only, a", + Name: "active_only", Usage: "only list channels which are currently active", }, + cli.BoolFlag{ + Name: "inactive_only", + Usage: "only list channels which are currently inactive", + }, + cli.BoolFlag{ + Name: "public_only", + Usage: "only list channels which are currently public", + }, + cli.BoolFlag{ + Name: "private_only", + Usage: "only list channels which are currently private", + }, }, Action: actionDecorator(listChannels), } @@ -1397,7 +1409,13 @@ func listChannels(ctx *cli.Context) error { client, cleanUp := getClient(ctx) defer cleanUp() - req := &lnrpc.ListChannelsRequest{} + req := &lnrpc.ListChannelsRequest{ + ActiveOnly: ctx.Bool("active_only"), + InactiveOnly: ctx.Bool("inactive_only"), + PublicOnly: ctx.Bool("public_only"), + PrivateOnly: ctx.Bool("private_only"), + } + resp, err := client.ListChannels(ctxb, req) if err != nil { return err