diff options
author | Felix Lange <fjl@twurst.com> | 2016-09-22 08:23:50 +0800 |
---|---|---|
committer | Felix Lange <fjl@twurst.com> | 2016-11-11 00:46:45 +0800 |
commit | 1aaa5991472e5b4f379b3e5d7e3d20545f2a8099 (patch) | |
tree | f7a851076a4e7b819776c2f082e5e484a7540dd5 /accounts | |
parent | d27472cc74cf0a7ec28cef0a7ad27f7beb1a662a (diff) | |
download | dexon-1aaa5991472e5b4f379b3e5d7e3d20545f2a8099.tar.gz dexon-1aaa5991472e5b4f379b3e5d7e3d20545f2a8099.tar.zst dexon-1aaa5991472e5b4f379b3e5d7e3d20545f2a8099.zip |
accounts: add Find method
Diffstat (limited to 'accounts')
-rw-r--r-- | accounts/account_manager.go | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/accounts/account_manager.go b/accounts/account_manager.go index c8601c3c0..abe442388 100644 --- a/accounts/account_manager.go +++ b/accounts/account_manager.go @@ -228,11 +228,17 @@ func (am *Manager) TimedUnlock(a Account, passphrase string, timeout time.Durati return nil } -func (am *Manager) getDecryptedKey(a Account, auth string) (Account, *Key, error) { +// Find resolves the given account into a unique entry in the keystore. +func (am *Manager) Find(a Account) (Account, error) { am.cache.maybeReload() am.cache.mu.Lock() a, err := am.cache.find(a) am.cache.mu.Unlock() + return a, err +} + +func (am *Manager) getDecryptedKey(a Account, auth string) (Account, *Key, error) { + a, err := am.Find(a) if err != nil { return a, nil, err } |