mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-17 01:13:45 +00:00
accounts/keystore: address review concerns
This commit is contained in:
parent
b77771c1fb
commit
794564046f
2 changed files with 4 additions and 8 deletions
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Reference in a new issue