Set keystore dir & network id
This commit is contained in:
parent
3b97f94ccc
commit
522c578a35
|
@ -90,7 +90,7 @@ func defaultSettings(generatedAccountInfo generator.GeneratedAccountInfo, derive
|
||||||
func defaultNodeConfig(installationID string, request *requests.CreateAccount) (*params.NodeConfig, error) {
|
func defaultNodeConfig(installationID string, request *requests.CreateAccount) (*params.NodeConfig, error) {
|
||||||
// Set mainnet
|
// Set mainnet
|
||||||
nodeConfig := ¶ms.NodeConfig{}
|
nodeConfig := ¶ms.NodeConfig{}
|
||||||
nodeConfig.NetworkID = 1
|
nodeConfig.NetworkID = request.NetworkID
|
||||||
nodeConfig.LogEnabled = request.LogEnabled
|
nodeConfig.LogEnabled = request.LogEnabled
|
||||||
nodeConfig.LogFile = "geth.log"
|
nodeConfig.LogFile = "geth.log"
|
||||||
nodeConfig.LogDir = request.LogFilePath
|
nodeConfig.LogDir = request.LogFilePath
|
||||||
|
|
|
@ -733,9 +733,7 @@ func (b *GethStatusBackend) GetKeyUIDByMnemonic(mnemonic string) (string, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *GethStatusBackend) generateOrImportAccount(mnemonic string, request *requests.CreateAccount) error {
|
func (b *GethStatusBackend) generateOrImportAccount(mnemonic string, request *requests.CreateAccount) error {
|
||||||
if err := b.accountManager.InitKeystore(filepath.Join(request.BackupDisabledDataDir, keystoreRelativePath)); err != nil {
|
keystoreDir := filepath.Join(request.BackupDisabledDataDir, keystoreRelativePath)
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
b.UpdateRootDataDir(request.BackupDisabledDataDir)
|
b.UpdateRootDataDir(request.BackupDisabledDataDir)
|
||||||
err := b.OpenAccounts()
|
err := b.OpenAccounts()
|
||||||
|
@ -768,6 +766,12 @@ func (b *GethStatusBackend) generateOrImportAccount(mnemonic string, request *re
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
userKeyStoreDir := filepath.Join(keystoreDir, info.KeyUID)
|
||||||
|
// Initialize keystore dir with account
|
||||||
|
if err := b.accountManager.InitKeystore(userKeyStoreDir); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
_, err = accountGenerator.StoreDerivedAccounts(info.ID, request.Password, paths)
|
_, err = accountGenerator.StoreDerivedAccounts(info.ID, request.Password, paths)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -798,6 +802,8 @@ func (b *GethStatusBackend) generateOrImportAccount(mnemonic string, request *re
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nodeConfig.KeyStoreDir = userKeyStoreDir
|
||||||
|
|
||||||
walletDerivedAccount := derivedAddresses[pathDefaultWallet]
|
walletDerivedAccount := derivedAddresses[pathDefaultWallet]
|
||||||
walletAccount := &accounts.Account{
|
walletAccount := &accounts.Account{
|
||||||
PublicKey: types.Hex2Bytes(walletDerivedAccount.PublicKey),
|
PublicKey: types.Hex2Bytes(walletDerivedAccount.PublicKey),
|
||||||
|
@ -986,6 +992,7 @@ func (b *GethStatusBackend) StartNodeWithAccountAndInitialConfig(
|
||||||
nodecfg *params.NodeConfig,
|
nodecfg *params.NodeConfig,
|
||||||
subaccs []*accounts.Account,
|
subaccs []*accounts.Account,
|
||||||
) error {
|
) error {
|
||||||
|
b.log.Info("node config", "config", nodecfg)
|
||||||
err := b.SaveAccount(account)
|
err := b.SaveAccount(account)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
|
@ -1064,6 +1064,10 @@ func (m *Manager) DeleteCategory(request *requests.DeleteCommunityCategory) (*Co
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *Manager) HandleCommunityDescriptionMessage(signer *ecdsa.PublicKey, description *protobuf.CommunityDescription, payload []byte) (*CommunityResponse, error) {
|
func (m *Manager) HandleCommunityDescriptionMessage(signer *ecdsa.PublicKey, description *protobuf.CommunityDescription, payload []byte) (*CommunityResponse, error) {
|
||||||
|
if signer == nil {
|
||||||
|
return nil, errors.New("signer can't be nil")
|
||||||
|
}
|
||||||
|
|
||||||
id := crypto.CompressPubkey(signer)
|
id := crypto.CompressPubkey(signer)
|
||||||
community, err := m.persistence.GetByID(&m.identity.PublicKey, id)
|
community, err := m.persistence.GetByID(&m.identity.PublicKey, id)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -32,6 +32,7 @@ type CreateAccount struct {
|
||||||
LogEnabled bool `json:"logEnabled"`
|
LogEnabled bool `json:"logEnabled"`
|
||||||
PreviewPrivacy bool `json:"previewPrivacy"`
|
PreviewPrivacy bool `json:"previewPrivacy"`
|
||||||
CurrentNetwork string `json:"currentNetwork"`
|
CurrentNetwork string `json:"currentNetwork"`
|
||||||
|
NetworkID uint64 `json:"networkId"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *CreateAccount) Validate() error {
|
func (c *CreateAccount) Validate() error {
|
||||||
|
|
Loading…
Reference in New Issue