Skip to content

Commit 8c29a89

Browse files
committed
accounts/keystore: delete the redundant keystore in filename (ethereum#17930)
* accounts/keystore: reduce file name length * accounts/keystore: reduce code line width
1 parent a625fa9 commit 8c29a89

8 files changed

+17
-4
lines changed

accounts/keystore/account_cache.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,10 @@ func (ac *accountCache) scanAccounts() error {
265265
case (addr == common.Address{}):
266266
log.Debug("Failed to decode keystore key", "path", path, "err", "missing or zero address")
267267
default:
268-
return &accounts.Account{Address: addr, URL: accounts.URL{Scheme: KeyStoreScheme, Path: path}}
268+
return &accounts.Account{
269+
Address: addr,
270+
URL: accounts.URL{Scheme: KeyStoreScheme, Path: path},
271+
}
269272
}
270273
return nil
271274
}

accounts/keystore/key.go

+6-2
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,10 @@ func storeNewKey(ks keyStore, rand io.Reader, auth string) (*Key, accounts.Accou
169169
if err != nil {
170170
return nil, accounts.Account{}, err
171171
}
172-
a := accounts.Account{Address: key.Address, URL: accounts.URL{Scheme: KeyStoreScheme, Path: ks.JoinPath(keyFileName(key.Address))}}
172+
a := accounts.Account{
173+
Address: key.Address,
174+
URL: accounts.URL{Scheme: KeyStoreScheme, Path: ks.JoinPath(keyFileName(key.Address))},
175+
}
173176
if err := ks.StoreKey(a.URL.Path, key, auth); err != nil {
174177
zeroKey(key.PrivateKey)
175178
return nil, a, err
@@ -223,5 +226,6 @@ func toISO8601(t time.Time) string {
223226
} else {
224227
tz = fmt.Sprintf("%03d00", offset/3600)
225228
}
226-
return fmt.Sprintf("%04d-%02d-%02dT%02d-%02d-%02d.%09d%s", t.Year(), t.Month(), t.Day(), t.Hour(), t.Minute(), t.Second(), t.Nanosecond(), tz)
229+
return fmt.Sprintf("%04d-%02d-%02dT%02d-%02d-%02d.%09d%s",
230+
t.Year(), t.Month(), t.Day(), t.Hour(), t.Minute(), t.Second(), t.Nanosecond(), tz)
227231
}
File renamed without changes.
File renamed without changes.
File renamed without changes.

accounts/keystore/presale.go

+7-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,13 @@ func importPreSaleKey(keyStore keyStore, keyJSON []byte, password string) (accou
3838
return accounts.Account{}, nil, err
3939
}
4040
key.Id = uuid.NewRandom()
41-
a := accounts.Account{Address: key.Address, URL: accounts.URL{Scheme: KeyStoreScheme, Path: keyStore.JoinPath(keyFileName(key.Address))}}
41+
a := accounts.Account{
42+
Address: key.Address,
43+
URL: accounts.URL{
44+
Scheme: KeyStoreScheme,
45+
Path: keyStore.JoinPath(keyFileName(key.Address)),
46+
},
47+
}
4248
err = keyStore.StoreKey(a.URL.Path, key, password)
4349
return a, key, err
4450
}
File renamed without changes.

0 commit comments

Comments
 (0)