mirror of
https://github.com/status-im/status-go.git
synced 2025-02-18 01:37:22 +00:00
Fix wrong datadir in desktop (#1389)
Desktop was wrongly passing a network dependent data-dir (mainnet_rpc). The code migrates the db if present, moving it to the new location.
This commit is contained in:
parent
5d829f89f8
commit
e88e590028
@ -169,6 +169,18 @@ func (s *Service) initProtocol(address, encKey, password string) error {
|
|||||||
os.Remove(v4Path)
|
os.Remove(v4Path)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Desktop was passing a network dependent directory, which meant that
|
||||||
|
// if running on testnet it would not access the right db. This copies
|
||||||
|
// the db from mainnet to the root location.
|
||||||
|
networkDependentPath := filepath.Join(s.dataDir, "ethereum", "mainnet_rpc", fmt.Sprintf("%s.v4.db", s.installationID))
|
||||||
|
if _, err := os.Stat(networkDependentPath); err == nil {
|
||||||
|
if err := os.Rename(networkDependentPath, v4Path); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
} else if !os.IsNotExist(err) {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
persistence, err := chat.NewSQLLitePersistence(v4Path, encKey)
|
persistence, err := chat.NewSQLLitePersistence(v4Path, encKey)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
Loading…
x
Reference in New Issue
Block a user