make sure profile image is saved before node started (#3693)

This commit is contained in:
frank 2023-06-30 09:18:42 +08:00 committed by GitHub
parent 6ec50d52aa
commit a04e21013d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 16 deletions

View File

@ -1 +1 @@
0.160.0
0.160.1

View File

@ -12,6 +12,8 @@ import (
"sync"
"time"
"github.com/status-im/status-go/images"
"github.com/imdario/mergo"
"github.com/ethereum/go-ethereum/common/hexutil"
@ -25,7 +27,6 @@ import (
"github.com/status-im/status-go/connection"
"github.com/status-im/status-go/eth-node/crypto"
"github.com/status-im/status-go/eth-node/types"
"github.com/status-im/status-go/images"
"github.com/status-im/status-go/logutils"
"github.com/status-im/status-go/multiaccounts"
"github.com/status-im/status-go/multiaccounts/accounts"
@ -1028,6 +1029,13 @@ func (b *GethStatusBackend) generateOrImportAccount(mnemonic string, request *re
CustomizationColor: common.CustomizationColor(request.CustomizationColor),
KDFIterations: sqlite.ReducedKDFIterationsNumber,
}
if request.ImagePath != "" {
iis, err := images.GenerateIdentityImages(request.ImagePath, 0, 0, 1000, 1000)
if err != nil {
return err
}
account.Images = iis
}
settings, err := defaultSettings(info, derivedAddresses, nil)
if err != nil {
@ -1074,25 +1082,13 @@ func (b *GethStatusBackend) generateOrImportAccount(mnemonic string, request *re
Path: pathDefaultChat,
}
accounts := []*accounts.Account{walletAccount, chatAccount}
err = b.StartNodeWithAccountAndInitialConfig(account, request.Password, *settings, nodeConfig, accounts)
subAccounts := []*accounts.Account{walletAccount, chatAccount}
err = b.StartNodeWithAccountAndInitialConfig(account, request.Password, *settings, nodeConfig, subAccounts)
if err != nil {
b.log.Error("start node", err)
return err
}
if request.ImagePath != "" {
iis, err := images.GenerateIdentityImages(request.ImagePath, 0, 0, 1000, 1000)
if err != nil {
return err
}
err = b.multiaccountsDB.StoreIdentityImages(info.KeyUID, iis, false)
if err != nil {
return err
}
}
return nil
}