aboutsummaryrefslogtreecommitdiffstats
path: root/accounts
diff options
context:
space:
mode:
authorFelix Lange <fjl@twurst.com>2016-09-22 08:23:50 +0800
committerFelix Lange <fjl@twurst.com>2016-11-11 00:46:45 +0800
commit1aaa5991472e5b4f379b3e5d7e3d20545f2a8099 (patch)
treef7a851076a4e7b819776c2f082e5e484a7540dd5 /accounts
parentd27472cc74cf0a7ec28cef0a7ad27f7beb1a662a (diff)
downloadgo-tangerine-1aaa5991472e5b4f379b3e5d7e3d20545f2a8099.tar.gz
go-tangerine-1aaa5991472e5b4f379b3e5d7e3d20545f2a8099.tar.zst
go-tangerine-1aaa5991472e5b4f379b3e5d7e3d20545f2a8099.zip
accounts: add Find method
Diffstat (limited to 'accounts')
-rw-r--r--accounts/account_manager.go8
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
}