File tree Expand file tree Collapse file tree 1 file changed +57
-0
lines changed Expand file tree Collapse file tree 1 file changed +57
-0
lines changed Original file line number Diff line number Diff line change 1+ //go:build dev
2+ // +build dev
3+
4+ package main
5+
6+ import (
7+ "context"
8+
9+ "github.com/lightninglabs/loop/looprpc"
10+ "github.com/urfave/cli"
11+ )
12+
13+ func init () {
14+ // Register the debug command.
15+ commands = append (commands , forceAutoloopCmd )
16+ }
17+
18+ var forceAutoloopCmd = cli.Command {
19+ Name : "forceautoloop" ,
20+ Usage : "forces a autoloop tick" ,
21+ Action : forceAutoloop ,
22+ }
23+
24+ func forceAutoloop (ctx * cli.Context ) error {
25+ client , cleanup , err := getDebugClient (ctx )
26+ if err != nil {
27+ return err
28+ }
29+ defer cleanup ()
30+
31+ cfg , err := client .ForceAutoLoop (
32+ context .Background (), & looprpc.ForceAutoLoopRequest {},
33+ )
34+ if err != nil {
35+ return err
36+ }
37+
38+ printRespJSON (cfg )
39+
40+ return nil
41+ }
42+
43+ func getDebugClient (ctx * cli.Context ) (looprpc.DebugClient , func (), error ) {
44+ rpcServer := ctx .GlobalString ("rpcserver" )
45+ tlsCertPath , macaroonPath , err := extractPathArgs (ctx )
46+ if err != nil {
47+ return nil , nil , err
48+ }
49+ conn , err := getClientConn (rpcServer , tlsCertPath , macaroonPath )
50+ if err != nil {
51+ return nil , nil , err
52+ }
53+ cleanup := func () { conn .Close () }
54+
55+ debugClient := looprpc .NewDebugClient (conn )
56+ return debugClient , cleanup , nil
57+ }
You can’t perform that action at this time.
0 commit comments