mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-08-27 14:11:04 +02:00
This commit adds a new RPC command: `channelbalance` which returns the sum of all available channel capacity across all open channels. The total balance is currently returned in units of `satoshis`. Additionally the `networkHarness` has been modified slightly to allow specifying the additional "extra" command line parameters when creating the initial seed nodes. Minor refactoring within the integration tests has been undertaken in order to increase code re-use across tests. Closes #29.
This commit is contained in:
committed by
Olaoluwa Osuntokun
parent
4c01e42670
commit
2788dbeaa8
@@ -420,6 +420,26 @@ func walletBalance(ctx *cli.Context) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
var ChannelBalanceCommand = cli.Command{
|
||||
Name: "channelbalance",
|
||||
Description: "returns the sum of the total available channel balance across all open channels",
|
||||
Action: channelBalance,
|
||||
}
|
||||
|
||||
func channelBalance(ctx *cli.Context) error {
|
||||
ctxb := context.Background()
|
||||
client := getClient(ctx)
|
||||
|
||||
req := &lnrpc.ChannelBalanceRequest{}
|
||||
resp, err := client.ChannelBalance(ctxb, req)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
printRespJson(resp)
|
||||
return nil
|
||||
}
|
||||
|
||||
var GetInfoCommand = cli.Command{
|
||||
Name: "getinfo",
|
||||
Description: "returns basic information related to the active daemon",
|
||||
|
@@ -56,6 +56,7 @@ func main() {
|
||||
CloseChannelCommand,
|
||||
ListPeersCommand,
|
||||
WalletBalanceCommand,
|
||||
ChannelBalanceCommand,
|
||||
ShellCommand,
|
||||
GetInfoCommand,
|
||||
PendingChannelsCommand,
|
||||
|
Reference in New Issue
Block a user