diff --git a/accounts/keystore/account_cache.go b/accounts/keystore/account_cache.go index f19e6512a7..e5d03da53c 100644 --- a/accounts/keystore/account_cache.go +++ b/accounts/keystore/account_cache.go @@ -230,7 +230,6 @@ func (ac *accountCache) close() { // readAccount is a helper-function to read an encrypted keyfile func readAccount(path string, buf *bufio.Reader) *accounts.Account { - var key struct { Address string `json:"address"` } @@ -254,14 +253,12 @@ func readAccount(path string, buf *bufio.Reader) *accounts.Account { return &accounts.Account{Address: addr, URL: accounts.URL{Scheme: KeyStoreScheme, Path: path}} } return nil - } // checkFile can be used when a file notification triggered some kind of change on a file // in the keystore directory. The method checks what happened (change/delete/remove/nothing) and // updates the keystore accordingly func (ac *accountCache) checkFile(path string) error { - start := time.Now() created, deleted, updated, err := ac.fileC.checkFile(path) diff --git a/accounts/keystore/account_cache_test.go b/accounts/keystore/account_cache_test.go index 650ad4a74d..0da1cc80b4 100644 --- a/accounts/keystore/account_cache_test.go +++ b/accounts/keystore/account_cache_test.go @@ -51,9 +51,12 @@ var ( } ) +func init() { + rand.Seed(time.Now().UnixNano()) +} + // newTempDir returns the name of new temporary folder (not created yet) func newTempDir() (string, error) { - // On OSX, there's a problem // https://stackoverflow.com/questions/45122459/docker-mounts-denied-the-paths-are-not-shared-from-os-x-and-are-not-known/45123074#45123074 // @@ -63,9 +66,6 @@ func newTempDir() (string, error) { // However, if we start watching that directory, the notify-events will contain the // canonical paths, and thus e.g. deleted/updated files won't match our existing files. // TLDR; we need to use the canonical path, which we obtain via EvalSymlinks - - rand.Seed(time.Now().UnixNano()) - tmpdir, err := filepath.EvalSymlinks(os.TempDir()) if err != nil { return "", err @@ -115,7 +115,6 @@ func TestWatchNewFile(t *testing.T) { func TestWatchNoDir(t *testing.T) { t.Parallel() - // Create ks but not the directory that it watches. dir, err := newTempDir() if err != nil {