cmd/lncli: implement pendingchannels for the cli client

This commit is contained in:
Olaoluwa Osuntokun committed 2016-07-07 15:36:42 -07:00
1 parent a4e92fac8e
commit 40d9f0da31
2 files changed
+50

No files matched your search

+49
View File
@@ -388,3 +388,52 @@ func getInfo(ctx *cli.Context) error {
printRespJson(resp)
return nil
}
var PendingChannelsCommand = cli.Command{
Name: "pendingchannels",
Description: "display information pertaining to pending channels",
Usage: "pendingchannels --status=[all|opening|closing]",
Flags: []cli.Flag{
cli.BoolFlag{
Name: "open, o",
Usage: "display the status of new pending channels",
},
cli.BoolFlag{
Name: "close, c",
Usage: "display the status of channels being closed",
},
cli.BoolFlag{
Name: "all, a",
Usage: "display the status of channels in the " +
"process of being opened or closed",
},
},
Action: pendingChannels,
}
func pendingChannels(ctx *cli.Context) error {
ctxb := context.Background()
client := getClient(ctx)
var channelStatus lnrpc.ChannelStatus
switch {
case ctx.Bool("all"):
channelStatus = lnrpc.ChannelStatus_ALL
case ctx.Bool("open"):
channelStatus = lnrpc.ChannelStatus_OPENING
case ctx.Bool("close"):
channelStatus = lnrpc.ChannelStatus_CLOSING
default:
channelStatus = lnrpc.ChannelStatus_ALL
}
req := &lnrpc.PendingChannelRequest{channelStatus}
resp, err := client.PendingChannels(ctxb, req)
if err != nil {
return err
}
printRespJson(resp)
return nil
}
+1
View File
@@ -58,6 +58,7 @@ func main() {
WalletBalanceCommand,
ShellCommand,
GetInfoCommand,
PendingChannelsCommand,
}
if err := app.Run(os.Args); err != nil {