From 957df98777187fd2bd7b004fb353d45df050d804 Mon Sep 17 00:00:00 2001 From: Elle Mouton Date: Mon, 13 Feb 2023 17:30:10 +0200 Subject: [PATCH] lncli: add new exclude-exhausted-sessions option --- cmd/lncli/wtclient.go | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/cmd/lncli/wtclient.go b/cmd/lncli/wtclient.go index 93d24c80d..c08601c32 100644 --- a/cmd/lncli/wtclient.go +++ b/cmd/lncli/wtclient.go @@ -151,6 +151,12 @@ var listTowersCommand = cli.Command{ Usage: "include sessions with the watchtower in the " + "response", }, + cli.BoolFlag{ + Name: "exclude_exhausted_sessions", + Usage: "Whether to exclude exhausted sessions in " + + "the response info. This option is only " + + "meaningful if include_sessions is true", + }, }, Action: actionDecorator(listTowers), } @@ -160,7 +166,7 @@ func listTowers(ctx *cli.Context) error { // Display the command's help message if the number of arguments/flags // is not what we expect. - if ctx.NArg() > 0 || ctx.NumFlags() > 1 { + if ctx.NArg() > 0 || ctx.NumFlags() > 2 { return cli.ShowCommandHelp(ctx, "towers") } @@ -169,6 +175,9 @@ func listTowers(ctx *cli.Context) error { req := &wtclientrpc.ListTowersRequest{ IncludeSessions: ctx.Bool("include_sessions"), + ExcludeExhaustedSessions: ctx.Bool( + "exclude_exhausted_sessions", + ), } resp, err := client.ListTowers(ctxc, req) if err != nil { @@ -190,6 +199,12 @@ var getTowerCommand = cli.Command{ Usage: "include sessions with the watchtower in the " + "response", }, + cli.BoolFlag{ + Name: "exclude_exhausted_sessions", + Usage: "Whether to exclude exhausted sessions in " + + "the response info. This option is only " + + "meaningful if include_sessions is true", + }, }, Action: actionDecorator(getTower), } @@ -199,7 +214,7 @@ func getTower(ctx *cli.Context) error { // Display the command's help message if the number of arguments/flags // is not what we expect. - if ctx.NArg() != 1 || ctx.NumFlags() > 1 { + if ctx.NArg() != 1 || ctx.NumFlags() > 2 { return cli.ShowCommandHelp(ctx, "tower") } @@ -217,6 +232,9 @@ func getTower(ctx *cli.Context) error { req := &wtclientrpc.GetTowerInfoRequest{ Pubkey: pubKey, IncludeSessions: ctx.Bool("include_sessions"), + ExcludeExhaustedSessions: ctx.Bool( + "exclude_exhausted_sessions", + ), } resp, err := client.GetTowerInfo(ctxc, req) if err != nil {