mirror of
https://github.com/lightninglabs/loop.git
synced 2026-08-17 13:06:51 +02:00
loopd: Run migration if boltdb exists
This commit is contained in:
parent
69b4df0d9b
commit
a2abcd07d8
2 changed files with 108 additions and 4 deletions
|
|
@ -370,8 +370,24 @@ func (d *Daemon) initialize(withMacaroonService bool) error {
|
|||
}
|
||||
}
|
||||
|
||||
// Both the client RPC server and and the swap server client should
|
||||
// stop on main context cancel. So we create it early and pass it down.
|
||||
d.mainCtx, d.mainCtxCancel = context.WithCancel(context.Background())
|
||||
|
||||
log.Infof("Swap server address: %v", d.cfg.Server.Host)
|
||||
|
||||
// Check if we need to migrate the database.
|
||||
if needSqlMigration(d.cfg) {
|
||||
log.Infof("Boltdb found, running migration")
|
||||
|
||||
err := migrateBoltdb(d.mainCtx, d.cfg)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to migrate boltdb: %v", err)
|
||||
}
|
||||
|
||||
log.Infof("Successfully migrated boltdb")
|
||||
}
|
||||
|
||||
// Create an instance of the loop client library.
|
||||
swapclient, clientCleanup, err := getClient(d.cfg, &d.lnd.LndServices)
|
||||
if err != nil {
|
||||
|
|
@ -379,10 +395,6 @@ func (d *Daemon) initialize(withMacaroonService bool) error {
|
|||
}
|
||||
d.clientCleanup = clientCleanup
|
||||
|
||||
// Both the client RPC server and and the swap server client should
|
||||
// stop on main context cancel. So we create it early and pass it down.
|
||||
d.mainCtx, d.mainCtxCancel = context.WithCancel(context.Background())
|
||||
|
||||
// Add our debug permissions to our main set of required permissions
|
||||
// if compiled in.
|
||||
for endpoint, perm := range debugRequiredPermissions {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue