Address code review comments

This commit is contained in:
Pedro Pombeiro 2019-12-30 10:43:51 +01:00 committed by Pedro Pombeiro
parent 287e5cdf79
commit 527cd38e1f
3 changed files with 8 additions and 8 deletions

View File

@ -9,15 +9,15 @@ import (
// GethManager represents account manager interface.
type GethManager struct {
Manager
*Manager
manager *accounts.Manager
gethAccManager *accounts.Manager
}
// NewManager returns new node account manager.
func NewManager() *GethManager {
m := &GethManager{}
m.accountsGenerator = generator.New(m)
m.Manager = &Manager{accountsGenerator: generator.New(m)}
return m
}
@ -27,16 +27,16 @@ func (m *GethManager) InitKeystore(keydir string) error {
defer m.mu.Unlock()
var err error
m.manager, err = makeAccountManager(keydir)
m.gethAccManager, err = makeAccountManager(keydir)
if err != nil {
return err
}
m.keystore, err = makeKeyStore(m.manager)
m.keystore, err = makeKeyStore(m.gethAccManager)
return err
}
func (m *GethManager) GetManager() *accounts.Manager {
m.mu.RLock()
defer m.mu.RUnlock()
return m.manager
return m.gethAccManager
}

View File

@ -386,7 +386,7 @@ func (b *GethStatusBackend) subscriptionService() gethnode.ServiceConstructor {
func (b *GethStatusBackend) accountsService(accountsFeed *event.Feed) gethnode.ServiceConstructor {
return func(*gethnode.ServiceContext) (gethnode.Service, error) {
return accountssvc.NewService(accounts.NewDB(b.appDB), b.multiaccountsDB, &b.accountManager.Manager, accountsFeed), nil
return accountssvc.NewService(accounts.NewDB(b.appDB), b.multiaccountsDB, b.accountManager.Manager, accountsFeed), nil
}
}

View File

@ -9,7 +9,7 @@ import (
var (
// ErrUpdatingWrongAccount raised if caller tries to update any other account except one used for login.
ErrUpdatingWrongAccount = errors.New("failed to updating wrong account. please login with that account first")
ErrUpdatingWrongAccount = errors.New("failed to update wrong account. Please login with that account first")
)
func NewMultiAccountsAPI(db *multiaccounts.Database, manager *account.Manager) *MultiAccountsAPI {