diff --git a/accounts/keystore/account_cache.go b/accounts/keystore/account_cache.go index dc6ac6ccb3..77c19ddd9f 100644 --- a/accounts/keystore/account_cache.go +++ b/accounts/keystore/account_cache.go @@ -209,6 +209,12 @@ func (ac *accountCache) close() { // Callers must hold ac.mu. func (ac *accountCache) reload() { accounts, err := ac.scan() + ac.handleScanResult(accounts, err) +} + +// handleScanResult uses the result of a fs scan to update the account lists +// This can be used to perform un-mutexed fs scans +func (ac *accountCache) handleScanResult(accounts []accounts.Account, err error) { if err != nil { log.Debug("Failed to reload keystore contents", "err", err) } diff --git a/accounts/keystore/watch.go b/accounts/keystore/watch.go index f4d6477912..363587223d 100644 --- a/accounts/keystore/watch.go +++ b/accounts/keystore/watch.go @@ -99,8 +99,9 @@ func (w *watcher) loop() { hadEvent = true } case <-debounce.C: + accounts, err := w.ac.scan() w.ac.mu.Lock() - w.ac.reload() + w.ac.handleScanResult(accounts, err) w.ac.mu.Unlock() if hadEvent { debounce.Reset(debounceDuration)