diff --git a/cmd/statusd/main.go b/cmd/statusd/main.go index e5587c03c..14c3853ac 100644 --- a/cmd/statusd/main.go +++ b/cmd/statusd/main.go @@ -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()), diff --git a/node/get_status_node.go b/node/get_status_node.go index 0c91fa8fe..44d4c51f9 100644 --- a/node/get_status_node.go +++ b/node/get_status_node.go @@ -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 +}