File tree Expand file tree Collapse file tree 2 files changed +50
-0
lines changed Expand file tree Collapse file tree 2 files changed +50
-0
lines changed Original file line number Diff line number Diff line change @@ -77,6 +77,7 @@ func main() {
77
77
app .Commands = append (app .Commands , autopilotCommands )
78
78
app .Commands = append (app .Commands , litCommands ... )
79
79
app .Commands = append (app .Commands , helperCommands )
80
+ app .Commands = append (app .Commands , statusCommands ... )
80
81
81
82
err := app .Run (os .Args )
82
83
if err != nil {
Original file line number Diff line number Diff line change
1
+ package main
2
+
3
+ import (
4
+ "context"
5
+
6
+ "github.com/lightninglabs/lightning-terminal/litrpc"
7
+ "github.com/lightningnetwork/lnd/lnrpc"
8
+ "github.com/urfave/cli"
9
+ )
10
+
11
+ var statusCommands = []cli.Command {
12
+ {
13
+ Name : "status" ,
14
+ Usage : "info about litd status" ,
15
+ Category : "Status" ,
16
+ Action : getStatus ,
17
+ },
18
+ }
19
+
20
+ func getStatus (ctx * cli.Context ) error {
21
+ clientConn , cleanup , err := connectClient (ctx , true )
22
+ if err != nil {
23
+ return err
24
+ }
25
+ defer cleanup ()
26
+ litClient := litrpc .NewStatusClient (clientConn )
27
+
28
+ // Get LiT's status.
29
+ ctxb := context .Background ()
30
+ litResp , err := litClient .SubServerStatus (
31
+ ctxb , & litrpc.SubServerStatusReq {},
32
+ )
33
+ if err != nil {
34
+ return err
35
+ }
36
+
37
+ printRespJSON (litResp )
38
+
39
+ // Get LND's state.
40
+ lndClient := lnrpc .NewStateClient (clientConn )
41
+ lndResp , err := lndClient .GetState (ctxb , & lnrpc.GetStateRequest {})
42
+ if err != nil {
43
+ return err
44
+ }
45
+
46
+ printRespJSON (lndResp )
47
+
48
+ return nil
49
+ }
You can’t perform that action at this time.
0 commit comments