fix: keystore path is incorrect after merge (#2472)

This commit is contained in:
Richard Ramos 2021-12-22 16:08:09 +00:00 committed by GitHub
parent 33250c9134
commit 91e9fb4804
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 21 additions and 6 deletions

View File

@ -338,6 +338,25 @@ func (b *GethStatusBackend) StartNodeWithKey(acc multiaccounts.Account, password
return err
}
func (b *GethStatusBackend) mergeConfig(nodecfg *params.NodeConfig) (*params.NodeConfig, error) {
var conf params.NodeConfig
accountDB := accounts.NewDB(b.appDB)
if err := accountDB.GetNodeConfig(&conf); err != nil {
return nil, err
}
// Overwrite db configuration
if err := mergo.Merge(&conf, nodecfg, mergo.WithOverride); err != nil {
return nil, err
}
if err := b.saveNodeConfig(&conf); err != nil {
return nil, err
}
return b.loadNodeConfig()
}
func (b *GethStatusBackend) startNodeWithAccount(acc multiaccounts.Account, password string, nodecfg *params.NodeConfig) error {
err := b.ensureAppDBOpened(acc, password)
if err != nil {
@ -349,12 +368,8 @@ func (b *GethStatusBackend) startNodeWithAccount(acc multiaccounts.Account, pass
}
if nodecfg != nil {
// Overwrite db configuration
if err := mergo.Merge(conf, nodecfg, mergo.WithOverride); err != nil {
return err
}
if err := b.saveNodeConfig(conf); err != nil {
conf, err = b.mergeConfig(nodecfg)
if err != nil {
return err
}
}