From 1aaa5991472e5b4f379b3e5d7e3d20545f2a8099 Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Thu, 22 Sep 2016 02:23:50 +0200 Subject: [PATCH] accounts: add Find method --- accounts/account_manager.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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 }