temporary fix: data/log dir looks weired after local pair sync (#3159)
This commit is contained in:
parent
03c61e8847
commit
5ea8906dda
|
@ -5,6 +5,7 @@ import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
|
|
||||||
|
@ -79,7 +80,17 @@ func (s *SyncRawMessageHandler) PrepareRawMessage(keyUID string) ([]byte, error)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
nodeConfig := s.backend.StatusNode().Config()
|
nodeConfig := s.backend.StatusNode().Config()
|
||||||
|
dataDir := nodeConfig.DataDir
|
||||||
|
disabledDataDir := nodeConfig.ShhextConfig.BackupDisabledDataDir
|
||||||
|
defer func() {
|
||||||
|
// restore data dir
|
||||||
|
nodeConfig.DataDir = dataDir
|
||||||
|
nodeConfig.ShhextConfig.BackupDisabledDataDir = disabledDataDir
|
||||||
|
}()
|
||||||
|
nodeConfig.DataDir = strings.Replace(dataDir, nodeConfig.RootDataDir, "", 1)
|
||||||
|
nodeConfig.ShhextConfig.BackupDisabledDataDir = strings.Replace(disabledDataDir, nodeConfig.RootDataDir, "", 1)
|
||||||
if syncRawMessage.NodeConfigJsonBytes, err = json.Marshal(nodeConfig); err != nil {
|
if syncRawMessage.NodeConfigJsonBytes, err = json.Marshal(nodeConfig); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -99,13 +110,17 @@ func (s *SyncRawMessageHandler) HandleRawMessage(account *multiaccounts.Account,
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//TODO root data dir should be passed from client, following is a temporary solution
|
||||||
nodeConfig.RootDataDir = filepath.Dir(keystorePath)
|
nodeConfig.RootDataDir = filepath.Dir(keystorePath)
|
||||||
nodeConfig.DataDir = filepath.Join(nodeConfig.RootDataDir, filepath.Base(nodeConfig.DataDir))
|
nodeConfig.KeyStoreDir = filepath.Join(filepath.Base(keystorePath), account.KeyUID)
|
||||||
nodeConfig.KeyStoreDir = newKeystoreDir
|
|
||||||
installationID := uuid.New().String()
|
installationID := uuid.New().String()
|
||||||
nodeConfig.ShhextConfig.InstallationID = installationID
|
nodeConfig.ShhextConfig.InstallationID = installationID
|
||||||
setting.InstallationID = installationID
|
setting.InstallationID = installationID
|
||||||
|
|
||||||
|
//TODO we need a better way(e.g. pass from client when doing local pair?) to handle this, following is a temporary solution
|
||||||
|
nodeConfig.LogDir = nodeConfig.RootDataDir
|
||||||
|
nodeConfig.LogFile = "geth.log"
|
||||||
|
|
||||||
err = s.backend.StartNodeWithAccountAndInitialConfig(*account, password, *setting, nodeConfig, subAccounts)
|
err = s.backend.StartNodeWithAccountAndInitialConfig(*account, password, *setting, nodeConfig, subAccounts)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
Loading…
Reference in New Issue