Skip to content

Commit 2fc07ff

Browse files
committed
lit: add a statelessInit bool in the config
So that it is easy to check elsewhere if we are in this mode.
1 parent d3133ff commit 2fc07ff

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

config.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,10 @@ type Config struct {
224224
poolRemote bool
225225
tapRemote bool
226226

227+
// statelessInitMode is true if LND and LiT are running in stateless
228+
// init mode, meaning that no macaroon files are persisted to disk.
229+
statelessInitMode bool
230+
227231
// lndAdminMacaroon is the admin macaroon that is given to us by lnd
228232
// over an in-memory connection on startup. This is only set in
229233
// integrated lnd mode.

terminal.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -679,7 +679,6 @@ func (g *LightningTerminal) start() error {
679679

680680
// If we're in integrated and stateless init mode, we won't create
681681
// macaroon files in any of the subserver daemons.
682-
createDefaultMacaroons := true
683682
if g.cfg.LndMode == ModeIntegrated && g.lndInterceptorChain != nil &&
684683
g.lndInterceptorChain.MacaroonService() != nil {
685684

@@ -689,16 +688,17 @@ func (g *LightningTerminal) start() error {
689688
// daemons. In all other cases we want default macaroons so we
690689
// can use the CLI tools to interact with loop/pool/faraday.
691690
macService := g.lndInterceptorChain.MacaroonService()
692-
createDefaultMacaroons = !macService.StatelessInit
691+
g.cfg.statelessInitMode = macService.StatelessInit
693692
}
694693

695694
// Both connection types are ready now, let's start our sub-servers if
696695
// they should be started locally as an integrated service.
696+
createDefaultMacaroons := !g.cfg.statelessInitMode
697697
g.subServerMgr.StartIntegratedServers(
698698
g.basicClient, g.lndClient, createDefaultMacaroons,
699699
)
700700

701-
err = g.startInternalSubServers(createDefaultMacaroons)
701+
err = g.startInternalSubServers(!g.cfg.statelessInitMode)
702702
if err != nil {
703703
return fmt.Errorf("could not start litd sub-servers: %v", err)
704704
}

0 commit comments

Comments
 (0)