accounts/keystore: reverted #15498, added docs

This commit is contained in:
Martin Holst Swende 2017-12-01 11:19:07 +01:00
parent eaa880ad28
commit b77771c1fb
No known key found for this signature in database
GPG key ID: 683B438C05A5DDF0
2 changed files with 4 additions and 7 deletions

View file

@ -228,6 +228,7 @@ func (ac *accountCache) close() {
ac.mu.Unlock()
}
// readAccount is a helper-function to read an encrypted keyfile
func readAccount(path string, buf *bufio.Reader) *accounts.Account {
var key struct {
@ -298,7 +299,6 @@ func (ac *accountCache) checkFile(path string) error {
// scanAccounts checks if any changes have occurred on the filesystem, and
// updates the account cache accordingly
func (ac *accountCache) scanAccounts() error {
// Scan the entire folder metadata for file changes
creates, deletes, updates, err := ac.fileC.scan(ac.keydir)

View file

@ -376,8 +376,7 @@ func TestUpdatedKeyfileContents(t *testing.T) {
return
}
// needed so that modTime of `file` is different to its current value after forceCopyFile
time.Sleep(1000 * time.Millisecond)
time.Sleep(200 * time.Millisecond)
// Now replace file contents
if err := forceCopyFile(file, cachetestAccounts[1].URL.Path); err != nil {
@ -392,8 +391,7 @@ func TestUpdatedKeyfileContents(t *testing.T) {
return
}
// needed so that modTime of `file` is different to its current value after forceCopyFile
time.Sleep(1000 * time.Millisecond)
time.Sleep(200 * time.Millisecond)
// Now replace file contents again
if err := forceCopyFile(file, cachetestAccounts[2].URL.Path); err != nil {
@ -408,8 +406,7 @@ func TestUpdatedKeyfileContents(t *testing.T) {
return
}
// needed so that modTime of `file` is different to its current value after ioutil.WriteFile
time.Sleep(1000 * time.Millisecond)
time.Sleep(200 * time.Millisecond)
// Now replace file contents with crap
if err := ioutil.WriteFile(file, []byte("foo"), 0644); err != nil {