Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions cmd/commands/cmd_imputed_cost.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package commands

import (
"github.com/lightningnetwork/lnd/lnrpc/routerrpc"
"github.com/urfave/cli"
)

var queryImputedCostManagerCommand = cli.Command{
Name: "queryicm",
Category: "Imputed Costs", // TODO: subcommand for imputed costs?
Usage: "Query the internal state of the imputed cost manager.",
Description: `
Query the internal state of the imputed cost manager.
`,
Flags: []cli.Flag{
cli.StringSliceFlag{
Name: "namespace",
Usage: "(optional) name of the namespace. This flag " +
"can be specified multiple times in the same " +
"command.",
},
},
Action: actionDecorator(queryImputedCostManager),
}

func queryImputedCostManager(ctx *cli.Context) error {
ctxc := getContext()
conn := getClientConn(ctx, false)
defer conn.Close()

client := routerrpc.NewRouterClient(conn)

req := &routerrpc.QueryImputedCostsRequest{}
namespaces := ctx.StringSlice("namespace")
if len(namespaces) > 0 {
req.Namespaces = namespaces
}

snapshot, err := client.XQueryImputedCosts(ctxc, req)
if err != nil {
return err
}

printRespJSON(snapshot)

return nil
}
1 change: 1 addition & 0 deletions cmd/commands/routerrpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@ func routerCommands() []cli.Command {
getCfgCommand,
setCfgCommand,
updateChanStatusCommand,
queryImputedCostManagerCommand,
}
}
Loading
Loading