Skip to content

Commit 92b13f5

Browse files
committed
staticaddr: add swap client to cmd
1 parent c1b10a0 commit 92b13f5

File tree

1 file changed

+2
-20
lines changed

1 file changed

+2
-20
lines changed

cmd/loop/staticaddr.go

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ func newStaticAddress(ctx *cli.Context) error {
3939
return cli.ShowCommandHelp(ctx, "new")
4040
}
4141

42-
client, cleanup, err := getAddressClient(ctx)
42+
client, cleanup, err := getClient(ctx)
4343
if err != nil {
4444
return err
4545
}
@@ -86,7 +86,7 @@ func listUnspent(ctx *cli.Context) error {
8686
return cli.ShowCommandHelp(ctx, "listunspent")
8787
}
8888

89-
client, cleanup, err := getAddressClient(ctx)
89+
client, cleanup, err := getClient(ctx)
9090
if err != nil {
9191
return err
9292
}
@@ -104,21 +104,3 @@ func listUnspent(ctx *cli.Context) error {
104104

105105
return nil
106106
}
107-
108-
func getAddressClient(ctx *cli.Context) (looprpc.StaticAddressClientClient,
109-
func(), error) {
110-
111-
rpcServer := ctx.GlobalString("rpcserver")
112-
tlsCertPath, macaroonPath, err := extractPathArgs(ctx)
113-
if err != nil {
114-
return nil, nil, err
115-
}
116-
conn, err := getClientConn(rpcServer, tlsCertPath, macaroonPath)
117-
if err != nil {
118-
return nil, nil, err
119-
}
120-
cleanup := func() { conn.Close() }
121-
122-
addressClient := looprpc.NewStaticAddressClientClient(conn)
123-
return addressClient, cleanup, nil
124-
}

0 commit comments

Comments
 (0)