File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ package commands
2+
3+ import (
4+ "github.com/lightningnetwork/lnd/lnrpc/routerrpc"
5+ "github.com/urfave/cli"
6+ )
7+
8+ var queryImputedCostManagerCommand = cli.Command {
9+ Name : "queryicm" ,
10+ Category : "Imputed Costs" , // TODO: subcommand for imputed costs?
11+ Usage : "Query the internal state of the imputed cost manager." ,
12+ Description : `
13+ Query the internal state of the imputed cost manager.
14+ ` ,
15+ Flags : []cli.Flag {
16+ cli.StringSliceFlag {
17+ Name : "namespace" ,
18+ Usage : "(optional) name of the namespace. This flag " +
19+ "can be specified multiple times in the same " +
20+ "command." ,
21+ },
22+ },
23+ Action : actionDecorator (queryImputedCostManager ),
24+ }
25+
26+ func queryImputedCostManager (ctx * cli.Context ) error {
27+ ctxc := getContext ()
28+ conn := getClientConn (ctx , false )
29+ defer conn .Close ()
30+
31+ client := routerrpc .NewRouterClient (conn )
32+
33+ req := & routerrpc.QueryImputedCostsRequest {}
34+ namespaces := ctx .StringSlice ("namespace" )
35+ if len (namespaces ) > 0 {
36+ req .Namespaces = namespaces
37+ }
38+
39+ snapshot , err := client .XQueryImputedCosts (ctxc , req )
40+ if err != nil {
41+ return err
42+ }
43+
44+ printRespJSON (snapshot )
45+
46+ return nil
47+ }
Original file line number Diff line number Diff line change @@ -14,5 +14,6 @@ func routerCommands() []cli.Command {
1414 getCfgCommand ,
1515 setCfgCommand ,
1616 updateChanStatusCommand ,
17+ queryImputedCostManagerCommand ,
1718 }
1819}
You can’t perform that action at this time.
0 commit comments