terminal: move the location where statelessInitMode is set

So that it is set correctly by the time we potentially want to special
case the handling of the bakesupermacaroon method. This is required in
the case where the full LND connection takes long to create due to it
blocking on LND being fully synced.
This commit is contained in:
Elle Mouton 2024-10-04 14:08:50 +02:00
parent 6bcf19fb8e
commit d1e76950e5
No known key found for this signature in database
GPG key ID: D7D916376026F177

View file

@ -682,20 +682,6 @@ func (g *LightningTerminal) start() error {
// lnd clients.
g.statusMgr.SetRunning(subservers.LND)
// If we're in integrated and stateless init mode, we won't create
// macaroon files in any of the subserver daemons.
if g.cfg.LndMode == ModeIntegrated && g.lndInterceptorChain != nil &&
g.lndInterceptorChain.MacaroonService() != nil {
// If the wallet was initialized in stateless mode, we don't
// want any macaroons lying around on the filesystem. In that
// case only the UI will be able to access any of the integrated
// 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()
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
@ -821,6 +807,20 @@ func (g *LightningTerminal) setUpLNDClients(lndQuit chan struct{}) error {
}
g.basicClientSet.Store(true)
// If we're in integrated and stateless init mode, we won't create
// macaroon files in any of the subserver daemons.
if g.cfg.LndMode == ModeIntegrated && g.lndInterceptorChain != nil &&
g.lndInterceptorChain.MacaroonService() != nil {
// If the wallet was initialized in stateless mode, we don't
// want any macaroons lying around on the filesystem. In that
// case only the UI will be able to access any of the integrated
// 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()
g.cfg.statelessInitMode = macService.StatelessInit
}
// Now we know that the connection itself is ready. But we also need to
// wait for two things: The chain notifier to be ready and the lnd
// wallet being fully synced to its chain backend. The chain notifier