mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-06-26 08:41:02 +02:00
cmd: expose ChannelBalance for decoration
This commit is contained in:
parent
675931ac9a
commit
7a3246855f
@ -1463,15 +1463,19 @@ func walletBalance(ctx *cli.Context) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
var channelBalanceCommand = cli.Command{
|
var ChannelBalanceCommand = cli.Command{
|
||||||
Name: "channelbalance",
|
Name: "channelbalance",
|
||||||
Category: "Channels",
|
Category: "Channels",
|
||||||
Usage: "Returns the sum of the total available channel balance across " +
|
Usage: "Returns the sum of the total available channel balance across " +
|
||||||
"all open channels.",
|
"all open channels.",
|
||||||
Action: actionDecorator(channelBalance),
|
Action: actionDecorator(func(c *cli.Context) error {
|
||||||
|
return ChannelBalance(c, nil)
|
||||||
|
}),
|
||||||
}
|
}
|
||||||
|
|
||||||
func channelBalance(ctx *cli.Context) error {
|
func ChannelBalance(ctx *cli.Context,
|
||||||
|
respDecorator ResponseDecorator[*lnrpc.ChannelBalanceResponse]) error {
|
||||||
|
|
||||||
ctxc := getContext()
|
ctxc := getContext()
|
||||||
client, cleanUp := getClient(ctx)
|
client, cleanUp := getClient(ctx)
|
||||||
defer cleanUp()
|
defer cleanUp()
|
||||||
@ -1482,6 +1486,13 @@ func channelBalance(ctx *cli.Context) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if respDecorator != nil {
|
||||||
|
err = respDecorator(ctx, resp)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
printRespJSON(resp)
|
printRespJSON(resp)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -458,7 +458,7 @@ func Main() {
|
|||||||
abandonChannelCommand,
|
abandonChannelCommand,
|
||||||
listPeersCommand,
|
listPeersCommand,
|
||||||
walletBalanceCommand,
|
walletBalanceCommand,
|
||||||
channelBalanceCommand,
|
ChannelBalanceCommand,
|
||||||
getInfoCommand,
|
getInfoCommand,
|
||||||
getDebugInfoCommand,
|
getDebugInfoCommand,
|
||||||
encryptDebugPackageCommand,
|
encryptDebugPackageCommand,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user