@@ -131,7 +131,7 @@ func (d *Daemon) Start() error {
131131 // server client, the swap client RPC server instance and our main swap
132132 // and error handlers. If this fails, then nothing has been started yet
133133 // and we can just return the error.
134- err = d .initialize ()
134+ err = d .initialize (true )
135135 if errors .Is (err , bbolt .ErrTimeout ) {
136136 // We're trying to be started as a standalone Loop daemon, most
137137 // likely LiT is already running and blocking the DB
@@ -163,7 +163,9 @@ func (d *Daemon) Start() error {
163163// create its own gRPC server but registers to an existing one. The same goes
164164// for REST (if enabled), instead of creating an own mux and HTTP server, we
165165// register to an existing one.
166- func (d * Daemon ) StartAsSubserver (lndGrpc * lndclient.GrpcLndServices ) error {
166+ func (d * Daemon ) StartAsSubserver (lndGrpc * lndclient.GrpcLndServices ,
167+ createDefaultMacaroonFile bool ) error {
168+
167169 // There should be no reason to start the daemon twice. Therefore return
168170 // an error if that's tried. This is mostly to guard against Start and
169171 // StartAsSubserver both being called.
@@ -179,7 +181,7 @@ func (d *Daemon) StartAsSubserver(lndGrpc *lndclient.GrpcLndServices) error {
179181 // the swap server client, the RPC server instance and our main swap
180182 // handlers. If this fails, then nothing has been started yet and we can
181183 // just return the error.
182- err := d .initialize ()
184+ err := d .initialize (createDefaultMacaroonFile )
183185 if errors .Is (err , bbolt .ErrTimeout ) {
184186 // We're trying to be started inside LiT so there most likely is
185187 // another standalone Loop process blocking the DB.
@@ -339,7 +341,7 @@ func (d *Daemon) startWebServers() error {
339341// the swap client RPC server instance and our main swap and error handlers. If
340342// this method fails with an error then no goroutine was started yet and no
341343// cleanup is necessary. If it succeeds, then goroutines have been spawned.
342- func (d * Daemon ) initialize () error {
344+ func (d * Daemon ) initialize (createDefaultMacaroonFile bool ) error {
343345 // If no swap server is specified, use the default addresses for mainnet
344346 // and testnet.
345347 if d .cfg .Server .Host == "" {
@@ -370,7 +372,7 @@ func (d *Daemon) initialize() error {
370372
371373 // Start the macaroon service and let it create its default macaroon in
372374 // case it doesn't exist yet.
373- err = d .startMacaroonService ()
375+ err = d .startMacaroonService (createDefaultMacaroonFile )
374376 if err != nil {
375377 // The client is the only thing we started yet, so if we clean
376378 // up its connection now, nothing else needs to be shut down at
0 commit comments