fix(statusd)_: proper db initialization for imported accounts

This commit is contained in:
Dario Gabriel Lipicar 2024-10-06 10:40:22 -03:00 committed by Anthony Laibe
parent 0791112404
commit ccc3e62ce6
2 changed files with 10 additions and 8 deletions

View File

@ -251,15 +251,9 @@ func main() {
return
}
appDB, walletDB, err := openDatabases(config.DataDir + "/" + installationID.String())
if err != nil {
log.Error("failed to open databases")
return
}
options := []protocol.Option{
protocol.WithDatabase(appDB),
protocol.WithWalletDatabase(walletDB),
protocol.WithDatabase(backend.StatusNode().GetAppDB()),
protocol.WithWalletDatabase(backend.StatusNode().GetWalletDB()),
protocol.WithTorrentConfig(&config.TorrentConfig),
protocol.WithWalletConfig(&config.WalletConfig),
protocol.WithAccountManager(backend.AccountManager()),

View File

@ -690,6 +690,10 @@ func (n *StatusNode) SetAppDB(db *sql.DB) {
n.appDB = db
}
func (n *StatusNode) GetAppDB() *sql.DB {
return n.appDB
}
func (n *StatusNode) SetMultiaccountsDB(db *multiaccounts.Database) {
n.multiaccountsDB = db
}
@ -697,3 +701,7 @@ func (n *StatusNode) SetMultiaccountsDB(db *multiaccounts.Database) {
func (n *StatusNode) SetWalletDB(db *sql.DB) {
n.walletDB = db
}
func (n *StatusNode) GetWalletDB() *sql.DB {
return n.walletDB
}