Address code review comments
This commit is contained in:
parent
287e5cdf79
commit
527cd38e1f
|
@ -9,15 +9,15 @@ import (
|
||||||
|
|
||||||
// GethManager represents account manager interface.
|
// GethManager represents account manager interface.
|
||||||
type GethManager struct {
|
type GethManager struct {
|
||||||
Manager
|
*Manager
|
||||||
|
|
||||||
manager *accounts.Manager
|
gethAccManager *accounts.Manager
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewManager returns new node account manager.
|
// NewManager returns new node account manager.
|
||||||
func NewManager() *GethManager {
|
func NewManager() *GethManager {
|
||||||
m := &GethManager{}
|
m := &GethManager{}
|
||||||
m.accountsGenerator = generator.New(m)
|
m.Manager = &Manager{accountsGenerator: generator.New(m)}
|
||||||
return m
|
return m
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,16 +27,16 @@ func (m *GethManager) InitKeystore(keydir string) error {
|
||||||
defer m.mu.Unlock()
|
defer m.mu.Unlock()
|
||||||
|
|
||||||
var err error
|
var err error
|
||||||
m.manager, err = makeAccountManager(keydir)
|
m.gethAccManager, err = makeAccountManager(keydir)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
m.keystore, err = makeKeyStore(m.manager)
|
m.keystore, err = makeKeyStore(m.gethAccManager)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *GethManager) GetManager() *accounts.Manager {
|
func (m *GethManager) GetManager() *accounts.Manager {
|
||||||
m.mu.RLock()
|
m.mu.RLock()
|
||||||
defer m.mu.RUnlock()
|
defer m.mu.RUnlock()
|
||||||
return m.manager
|
return m.gethAccManager
|
||||||
}
|
}
|
||||||
|
|
|
@ -386,7 +386,7 @@ func (b *GethStatusBackend) subscriptionService() gethnode.ServiceConstructor {
|
||||||
|
|
||||||
func (b *GethStatusBackend) accountsService(accountsFeed *event.Feed) gethnode.ServiceConstructor {
|
func (b *GethStatusBackend) accountsService(accountsFeed *event.Feed) gethnode.ServiceConstructor {
|
||||||
return func(*gethnode.ServiceContext) (gethnode.Service, error) {
|
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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ import (
|
||||||
|
|
||||||
var (
|
var (
|
||||||
// ErrUpdatingWrongAccount raised if caller tries to update any other account except one used for login.
|
// 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 {
|
func NewMultiAccountsAPI(db *multiaccounts.Database, manager *account.Manager) *MultiAccountsAPI {
|
||||||
|
|
Loading…
Reference in New Issue