lit: add a statelessInit bool in the config

So that it is easy to check elsewhere if we are in this mode.
This commit is contained in:
Elle Mouton 2024-09-13 14:46:47 +02:00
parent d3133ff109
commit 2fc07fffee
No known key found for this signature in database
GPG key ID: D7D916376026F177
2 changed files with 7 additions and 3 deletions

View file

@ -224,6 +224,10 @@ type Config struct {
poolRemote bool
tapRemote bool
// statelessInitMode is true if LND and LiT are running in stateless
// init mode, meaning that no macaroon files are persisted to disk.
statelessInitMode bool
// lndAdminMacaroon is the admin macaroon that is given to us by lnd
// over an in-memory connection on startup. This is only set in
// integrated lnd mode.

View file

@ -679,7 +679,6 @@ func (g *LightningTerminal) start() error {
// If we're in integrated and stateless init mode, we won't create
// macaroon files in any of the subserver daemons.
createDefaultMacaroons := true
if g.cfg.LndMode == ModeIntegrated && g.lndInterceptorChain != nil &&
g.lndInterceptorChain.MacaroonService() != nil {
@ -689,16 +688,17 @@ func (g *LightningTerminal) start() error {
// daemons. In all other cases we want default macaroons so we
// can use the CLI tools to interact with loop/pool/faraday.
macService := g.lndInterceptorChain.MacaroonService()
createDefaultMacaroons = !macService.StatelessInit
g.cfg.statelessInitMode = macService.StatelessInit
}
// Both connection types are ready now, let's start our sub-servers if
// they should be started locally as an integrated service.
createDefaultMacaroons := !g.cfg.statelessInitMode
g.subServerMgr.StartIntegratedServers(
g.basicClient, g.lndClient, createDefaultMacaroons,
)
err = g.startInternalSubServers(createDefaultMacaroons)
err = g.startInternalSubServers(!g.cfg.statelessInitMode)
if err != nil {
return fmt.Errorf("could not start litd sub-servers: %v", err)
}