diff --git a/api/defaults.go b/api/defaults.go index 5741b3347..c7467becb 100644 --- a/api/defaults.go +++ b/api/defaults.go @@ -90,7 +90,7 @@ func defaultSettings(generatedAccountInfo generator.GeneratedAccountInfo, derive func defaultNodeConfig(installationID string, request *requests.CreateAccount) (*params.NodeConfig, error) { // Set mainnet nodeConfig := ¶ms.NodeConfig{} - nodeConfig.NetworkID = 1 + nodeConfig.NetworkID = request.NetworkID nodeConfig.LogEnabled = request.LogEnabled nodeConfig.LogFile = "geth.log" nodeConfig.LogDir = request.LogFilePath diff --git a/api/geth_backend.go b/api/geth_backend.go index 1958c8f7f..32671ab8e 100644 --- a/api/geth_backend.go +++ b/api/geth_backend.go @@ -733,9 +733,7 @@ func (b *GethStatusBackend) GetKeyUIDByMnemonic(mnemonic string) (string, error) } func (b *GethStatusBackend) generateOrImportAccount(mnemonic string, request *requests.CreateAccount) error { - if err := b.accountManager.InitKeystore(filepath.Join(request.BackupDisabledDataDir, keystoreRelativePath)); err != nil { - return err - } + keystoreDir := filepath.Join(request.BackupDisabledDataDir, keystoreRelativePath) b.UpdateRootDataDir(request.BackupDisabledDataDir) err := b.OpenAccounts() @@ -768,6 +766,12 @@ func (b *GethStatusBackend) generateOrImportAccount(mnemonic string, request *re 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) if err != nil { return err @@ -798,6 +802,8 @@ func (b *GethStatusBackend) generateOrImportAccount(mnemonic string, request *re return err } + nodeConfig.KeyStoreDir = userKeyStoreDir + walletDerivedAccount := derivedAddresses[pathDefaultWallet] walletAccount := &accounts.Account{ PublicKey: types.Hex2Bytes(walletDerivedAccount.PublicKey), @@ -986,6 +992,7 @@ func (b *GethStatusBackend) StartNodeWithAccountAndInitialConfig( nodecfg *params.NodeConfig, subaccs []*accounts.Account, ) error { + b.log.Info("node config", "config", nodecfg) err := b.SaveAccount(account) if err != nil { return err diff --git a/protocol/communities/manager.go b/protocol/communities/manager.go index 8d3c85673..dc56c9656 100644 --- a/protocol/communities/manager.go +++ b/protocol/communities/manager.go @@ -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) { + if signer == nil { + return nil, errors.New("signer can't be nil") + } + id := crypto.CompressPubkey(signer) community, err := m.persistence.GetByID(&m.identity.PublicKey, id) if err != nil { diff --git a/protocol/requests/create_account.go b/protocol/requests/create_account.go index f26a5afe4..adb6f6244 100644 --- a/protocol/requests/create_account.go +++ b/protocol/requests/create_account.go @@ -32,6 +32,7 @@ type CreateAccount struct { LogEnabled bool `json:"logEnabled"` PreviewPrivacy bool `json:"previewPrivacy"` CurrentNetwork string `json:"currentNetwork"` + NetworkID uint64 `json:"networkId"` } func (c *CreateAccount) Validate() error {