Skip to content

Commit 977c63c

Browse files
committed
multi: use same order for daemons everywhere
This is a pure code-moving commit to use the same order of faraday->loop->pool everywhere we handle the damons. Only for consistency's sake.
1 parent e52141e commit 977c63c

File tree

3 files changed

+24
-24
lines changed

3 files changed

+24
-24
lines changed

config.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -367,13 +367,13 @@ func loadAndValidateConfig() (*Config, error) {
367367
// (like the log or lnd options) as they will be taken from lnd's config
368368
// struct. Others we want to force to be the same as lnd so the user
369369
// doesn't have to set them manually, like the network for example.
370-
if err := loopd.Validate(cfg.Loop); err != nil {
370+
if err := faraday.ValidateConfig(cfg.Faraday); err != nil {
371371
return nil, err
372372
}
373-
if err := pool.Validate(cfg.Pool); err != nil {
373+
if err := loopd.Validate(cfg.Loop); err != nil {
374374
return nil, err
375375
}
376-
if err := faraday.ValidateConfig(cfg.Faraday); err != nil {
376+
if err := pool.Validate(cfg.Pool); err != nil {
377377
return nil, err
378378
}
379379

rpc_proxy.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,8 @@ func newRpcProxy(cfg *Config, validator macaroons.MacaroonValidator,
107107
// v non-registered call |
108108
// +---+----------------------+ +---------v----------+
109109
// | director | | local subserver |
110-
// +---+----------------------+ | - loop |
111-
// | | - faraday |
110+
// +---+----------------------+ | - faraday |
111+
// | | - loop |
112112
// v authenticated call | - pool |
113113
// +---+----------------------+ +--------------------+
114114
// | lnd (remote or local) |
@@ -398,20 +398,20 @@ func (p *rpcProxy) basicAuthToMacaroon(ctx context.Context,
398398
case isLndURI(requestURI):
399399
_, _, _, macPath = p.cfg.lndConnectParams()
400400

401-
case isLoopURI(requestURI):
402-
if p.cfg.loopRemote {
403-
macPath = p.cfg.Remote.Loop.MacaroonPath
404-
} else {
405-
macPath = p.cfg.Loop.MacaroonPath
406-
}
407-
408401
case isFaradayURI(requestURI):
409402
if p.cfg.faradayRemote {
410403
macPath = p.cfg.Remote.Faraday.MacaroonPath
411404
} else {
412405
macPath = p.cfg.Faraday.MacaroonPath
413406
}
414407

408+
case isLoopURI(requestURI):
409+
if p.cfg.loopRemote {
410+
macPath = p.cfg.Remote.Loop.MacaroonPath
411+
} else {
412+
macPath = p.cfg.Loop.MacaroonPath
413+
}
414+
415415
case isPoolURI(requestURI):
416416
if p.cfg.poolRemote {
417417
macPath = p.cfg.Remote.Pool.MacaroonPath

terminal.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -403,37 +403,37 @@ func (g *LightningTerminal) ValidateMacaroon(ctx context.Context,
403403
// process. Calls that we proxy to a remote host don't need to be
404404
// checked as they'll have their own interceptor.
405405
switch {
406-
case isLoopURI(fullMethod):
406+
case isFaradayURI(fullMethod):
407407
// In remote mode we just pass through the request, the remote
408408
// daemon will check the macaroon.
409-
if g.cfg.loopRemote {
409+
if g.cfg.faradayRemote {
410410
return nil
411411
}
412412

413-
if !g.loopStarted {
414-
return fmt.Errorf("loop is not yet ready for " +
413+
if !g.faradayStarted {
414+
return fmt.Errorf("faraday is not yet ready for " +
415415
"requests, lnd possibly still starting or " +
416416
"syncing")
417417
}
418418

419-
return g.loopServer.ValidateMacaroon(
419+
return g.faradayServer.ValidateMacaroon(
420420
ctx, requiredPermissions, fullMethod,
421421
)
422422

423-
case isFaradayURI(fullMethod):
423+
case isLoopURI(fullMethod):
424424
// In remote mode we just pass through the request, the remote
425425
// daemon will check the macaroon.
426-
if g.cfg.faradayRemote {
426+
if g.cfg.loopRemote {
427427
return nil
428428
}
429429

430-
if !g.faradayStarted {
431-
return fmt.Errorf("faraday is not yet ready for " +
430+
if !g.loopStarted {
431+
return fmt.Errorf("loop is not yet ready for " +
432432
"requests, lnd possibly still starting or " +
433433
"syncing")
434434
}
435435

436-
return g.faradayServer.ValidateMacaroon(
436+
return g.loopServer.ValidateMacaroon(
437437
ctx, requiredPermissions, fullMethod,
438438
)
439439

@@ -554,8 +554,8 @@ func (g *LightningTerminal) shutdown() error {
554554
// v non-registered call |
555555
// +---+----------------------+ +---------v----------+
556556
// | director | | local subserver |
557-
// +---+----------------------+ | - loop |
558-
// | | - faraday |
557+
// +---+----------------------+ | - faraday |
558+
// | | - loop |
559559
// v authenticated call | - pool |
560560
// +---+----------------------+ +--------------------+
561561
// | lnd (remote or local) |

0 commit comments

Comments
 (0)