Skip to content

Commit 32d35c9

Browse files
jsvisakaralabe
authored andcommitted
accounts/keystore: delete the redundant keystore in filename (#17930)
* accounts/keystore: reduce file name length * accounts/keystore: reduce code line width
1 parent a4428c5 commit 32d35c9

8 files changed

+18
-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
@@ -171,7 +171,10 @@ func storeNewKey(ks keyStore, rand io.Reader, auth string) (*Key, accounts.Accou
171171
if err != nil {
172172
return nil, accounts.Account{}, err
173173
}
174-
a := accounts.Account{Address: key.Address, URL: accounts.URL{Scheme: KeyStoreScheme, Path: ks.JoinPath(keyFileName(key.Address))}}
174+
a := accounts.Account{
175+
Address: key.Address,
176+
URL: accounts.URL{Scheme: KeyStoreScheme, Path: ks.JoinPath(keyFileName(key.Address))},
177+
}
175178
if err := ks.StoreKey(a.URL.Path, key, auth); err != nil {
176179
zeroKey(key.PrivateKey)
177180
return nil, a, err
@@ -224,5 +227,6 @@ func toISO8601(t time.Time) string {
224227
} else {
225228
tz = fmt.Sprintf("%03d00", offset/3600)
226229
}
227-
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)
230+
return fmt.Sprintf("%04d-%02d-%02dT%02d-%02d-%02d.%09d%s",
231+
t.Year(), t.Month(), t.Day(), t.Hour(), t.Minute(), t.Second(), t.Nanosecond(), tz)
228232
}

accounts/keystore/keystore_passphrase.go accounts/keystore/passphrase.go

+1
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,7 @@ func DecryptKey(keyjson []byte, auth string) (*Key, error) {
233233
PrivateKey: key,
234234
}, nil
235235
}
236+
236237
func DecryptDataV3(cryptoJson CryptoJSON, auth string) ([]byte, error) {
237238
if cryptoJson.Cipher != "aes-128-ctr" {
238239
return nil, fmt.Errorf("Cipher not supported: %v", cryptoJson.Cipher)
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)