diff options
author | Wenbiao Zheng <delweng@gmail.com> | 2018-11-29 18:04:56 +0800 |
---|---|---|
committer | Péter Szilágyi <peterke@gmail.com> | 2018-11-29 18:04:56 +0800 |
commit | 32d35c9c088463efac49aeb0f3e6d48cfb373a40 (patch) | |
tree | fb414241de45f63e1215edba95d5d432d18f6e1e /accounts | |
parent | a4428c505e84aaa1982d4cc522e0c0ffe608890a (diff) | |
download | dexon-32d35c9c088463efac49aeb0f3e6d48cfb373a40.tar.gz dexon-32d35c9c088463efac49aeb0f3e6d48cfb373a40.tar.zst dexon-32d35c9c088463efac49aeb0f3e6d48cfb373a40.zip |
accounts/keystore: delete the redundant keystore in filename (#17930)
* accounts/keystore: reduce file name length
* accounts/keystore: reduce code line width
Diffstat (limited to 'accounts')
-rw-r--r-- | accounts/keystore/account_cache.go | 5 | ||||
-rw-r--r-- | accounts/keystore/key.go | 8 | ||||
-rw-r--r-- | accounts/keystore/passphrase.go (renamed from accounts/keystore/keystore_passphrase.go) | 1 | ||||
-rw-r--r-- | accounts/keystore/passphrase_test.go (renamed from accounts/keystore/keystore_passphrase_test.go) | 0 | ||||
-rw-r--r-- | accounts/keystore/plain.go (renamed from accounts/keystore/keystore_plain.go) | 0 | ||||
-rw-r--r-- | accounts/keystore/plain_test.go (renamed from accounts/keystore/keystore_plain_test.go) | 0 | ||||
-rw-r--r-- | accounts/keystore/presale.go | 8 | ||||
-rw-r--r-- | accounts/keystore/wallet.go (renamed from accounts/keystore/keystore_wallet.go) | 0 |
8 files changed, 18 insertions, 4 deletions
diff --git a/accounts/keystore/account_cache.go b/accounts/keystore/account_cache.go index da3a46eb8..8f660e282 100644 --- a/accounts/keystore/account_cache.go +++ b/accounts/keystore/account_cache.go @@ -265,7 +265,10 @@ func (ac *accountCache) scanAccounts() error { case (addr == common.Address{}): log.Debug("Failed to decode keystore key", "path", path, "err", "missing or zero address") default: - return &accounts.Account{Address: addr, URL: accounts.URL{Scheme: KeyStoreScheme, Path: path}} + return &accounts.Account{ + Address: addr, + URL: accounts.URL{Scheme: KeyStoreScheme, Path: path}, + } } return nil } diff --git a/accounts/keystore/key.go b/accounts/keystore/key.go index 0564751c4..84d8df0c5 100644 --- a/accounts/keystore/key.go +++ b/accounts/keystore/key.go @@ -171,7 +171,10 @@ func storeNewKey(ks keyStore, rand io.Reader, auth string) (*Key, accounts.Accou if err != nil { return nil, accounts.Account{}, err } - a := accounts.Account{Address: key.Address, URL: accounts.URL{Scheme: KeyStoreScheme, Path: ks.JoinPath(keyFileName(key.Address))}} + a := accounts.Account{ + Address: key.Address, + URL: accounts.URL{Scheme: KeyStoreScheme, Path: ks.JoinPath(keyFileName(key.Address))}, + } if err := ks.StoreKey(a.URL.Path, key, auth); err != nil { zeroKey(key.PrivateKey) return nil, a, err @@ -224,5 +227,6 @@ func toISO8601(t time.Time) string { } else { tz = fmt.Sprintf("%03d00", offset/3600) } - 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) + 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) } diff --git a/accounts/keystore/keystore_passphrase.go b/accounts/keystore/passphrase.go index 9794f32fe..a0b6cf538 100644 --- a/accounts/keystore/keystore_passphrase.go +++ b/accounts/keystore/passphrase.go @@ -233,6 +233,7 @@ func DecryptKey(keyjson []byte, auth string) (*Key, error) { PrivateKey: key, }, nil } + func DecryptDataV3(cryptoJson CryptoJSON, auth string) ([]byte, error) { if cryptoJson.Cipher != "aes-128-ctr" { return nil, fmt.Errorf("Cipher not supported: %v", cryptoJson.Cipher) diff --git a/accounts/keystore/keystore_passphrase_test.go b/accounts/keystore/passphrase_test.go index 630682ceb..630682ceb 100644 --- a/accounts/keystore/keystore_passphrase_test.go +++ b/accounts/keystore/passphrase_test.go diff --git a/accounts/keystore/keystore_plain.go b/accounts/keystore/plain.go index f62a133ce..f62a133ce 100644 --- a/accounts/keystore/keystore_plain.go +++ b/accounts/keystore/plain.go diff --git a/accounts/keystore/keystore_plain_test.go b/accounts/keystore/plain_test.go index 32852a0ad..32852a0ad 100644 --- a/accounts/keystore/keystore_plain_test.go +++ b/accounts/keystore/plain_test.go diff --git a/accounts/keystore/presale.go b/accounts/keystore/presale.go index 1554294e1..03055245f 100644 --- a/accounts/keystore/presale.go +++ b/accounts/keystore/presale.go @@ -38,7 +38,13 @@ func importPreSaleKey(keyStore keyStore, keyJSON []byte, password string) (accou return accounts.Account{}, nil, err } key.Id = uuid.NewRandom() - a := accounts.Account{Address: key.Address, URL: accounts.URL{Scheme: KeyStoreScheme, Path: keyStore.JoinPath(keyFileName(key.Address))}} + a := accounts.Account{ + Address: key.Address, + URL: accounts.URL{ + Scheme: KeyStoreScheme, + Path: keyStore.JoinPath(keyFileName(key.Address)), + }, + } err = keyStore.StoreKey(a.URL.Path, key, password) return a, key, err } diff --git a/accounts/keystore/keystore_wallet.go b/accounts/keystore/wallet.go index 758fdfe36..758fdfe36 100644 --- a/accounts/keystore/keystore_wallet.go +++ b/accounts/keystore/wallet.go |