Skip to content

Commit 6e1803b

Browse files
committed
multi: remove unused error return value
There is no error case left in the lndConnectParams() method so we can remove the error return type and simplify its use.
1 parent 680a47c commit 6e1803b

File tree

3 files changed

+12
-23
lines changed

3 files changed

+12
-23
lines changed

config.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,8 @@ type RemoteDaemonConfig struct {
188188

189189
// lndConnectParams returns the connection parameters to connect to the local
190190
// lnd instance.
191-
func (c *Config) lndConnectParams() (string, lndclient.Network, string, string,
192-
error) {
191+
func (c *Config) lndConnectParams() (string, lndclient.Network, string,
192+
string) {
193193

194194
// In remote lnd mode, we just pass along what was configured in the
195195
// remote section of the lnd config.
@@ -211,7 +211,7 @@ func (c *Config) lndConnectParams() (string, lndclient.Network, string, string,
211211
return c.Remote.Lnd.RPCServer,
212212
lndclient.Network(c.network),
213213
lncfg.CleanAndExpandPath(c.Remote.Lnd.TLSCertPath),
214-
macPath, nil
214+
macPath
215215
}
216216

217217
// When we start lnd internally, we take the listen address as
@@ -233,7 +233,7 @@ func (c *Config) lndConnectParams() (string, lndclient.Network, string, string,
233233
}
234234

235235
return lndDialAddr, lndclient.Network(c.network),
236-
c.Lnd.TLSCertPath, c.Lnd.AdminMacPath, nil
236+
c.Lnd.TLSCertPath, c.Lnd.AdminMacPath
237237
}
238238

239239
// defaultConfig returns a configuration struct with all default values set.

rpc_proxy.go

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -126,11 +126,10 @@ type rpcProxy struct {
126126

127127
// Start creates initial connection to lnd.
128128
func (p *rpcProxy) Start() error {
129+
var err error
130+
129131
// Setup the connection to lnd.
130-
host, _, tlsPath, _, err := p.cfg.lndConnectParams()
131-
if err != nil {
132-
return err
133-
}
132+
host, _, tlsPath, _ := p.cfg.lndConnectParams()
134133
p.lndConn, err = dialLnd(host, tlsPath)
135134
if err != nil {
136135
return fmt.Errorf("could not dial lnd: %v", err)
@@ -308,13 +307,10 @@ func (p *rpcProxy) basicAuthToMacaroon(ctx context.Context,
308307
return ctx, nil
309308
}
310309

311-
var (
312-
macPath string
313-
err error
314-
)
310+
var macPath string
315311
switch {
316312
case isLndURI(requestURI):
317-
_, _, _, macPath, err = p.cfg.lndConnectParams()
313+
_, _, _, macPath = p.cfg.lndConnectParams()
318314

319315
case isLoopURI(requestURI):
320316
macPath = p.cfg.Loop.MacaroonPath
@@ -329,9 +325,6 @@ func (p *rpcProxy) basicAuthToMacaroon(ctx context.Context,
329325
return ctx, fmt.Errorf("unknown gRPC web request: %v",
330326
requestURI)
331327
}
332-
if err != nil {
333-
return ctx, fmt.Errorf("error getting macaroon path: %v", err)
334-
}
335328

336329
// Now that we know which macaroon to load, do it and attach it to the
337330
// request context.

terminal.go

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -250,18 +250,14 @@ func (g *LightningTerminal) Run() error {
250250
// servers that lnd started.
251251
func (g *LightningTerminal) startSubservers() error {
252252
var basicClient lnrpc.LightningClient
253-
254-
host, network, tlsPath, macPath, err := g.cfg.lndConnectParams()
255-
if err != nil {
256-
return err
257-
}
253+
host, network, tlsPath, macPath := g.cfg.lndConnectParams()
258254

259255
// The main RPC listener of lnd might need some time to start, it could
260256
// be that we run into a connection refused a few times. We use the
261257
// basic client connection to find out if the RPC server is started yet
262258
// because that doesn't do anything else than just connect. We'll check
263259
// if lnd is also ready to be used in the next step.
264-
err = wait.NoError(func() error {
260+
err := wait.NoError(func() error {
265261
// Create an lnd client now that we have the full configuration.
266262
// We'll need a basic client and a full client because not all
267263
// subservers have the same requirements.
@@ -645,7 +641,7 @@ func (g *LightningTerminal) showStartupInfo() error {
645641
if g.cfg.LndMode == ModeRemote {
646642
// We try to query GetInfo on the remote node to find out the
647643
// alias. But the wallet might be locked.
648-
host, network, tlsPath, macPath, _ := g.cfg.lndConnectParams()
644+
host, network, tlsPath, macPath := g.cfg.lndConnectParams()
649645
basicClient, err := lndclient.NewBasicClient(
650646
host, tlsPath, path.Dir(macPath), string(network),
651647
lndclient.MacFilename(path.Base(macPath)),

0 commit comments

Comments
 (0)