fix: keystore path is incorrect after merge (#2472)
This commit is contained in:
parent
33250c9134
commit
91e9fb4804
|
@ -338,6 +338,25 @@ func (b *GethStatusBackend) StartNodeWithKey(acc multiaccounts.Account, password
|
||||||
return err
|
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 {
|
func (b *GethStatusBackend) startNodeWithAccount(acc multiaccounts.Account, password string, nodecfg *params.NodeConfig) error {
|
||||||
err := b.ensureAppDBOpened(acc, password)
|
err := b.ensureAppDBOpened(acc, password)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -349,12 +368,8 @@ func (b *GethStatusBackend) startNodeWithAccount(acc multiaccounts.Account, pass
|
||||||
}
|
}
|
||||||
|
|
||||||
if nodecfg != nil {
|
if nodecfg != nil {
|
||||||
// Overwrite db configuration
|
conf, err = b.mergeConfig(nodecfg)
|
||||||
if err := mergo.Merge(conf, nodecfg, mergo.WithOverride); err != nil {
|
if err != nil {
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := b.saveNodeConfig(conf); err != nil {
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue