From 7c74e166b0ee14cf040374f522bc399841a11e69 Mon Sep 17 00:00:00 2001 From: Egon Elbre Date: Mon, 7 Aug 2017 14:11:15 +0300 Subject: [PATCH] accounts: fix megacheck warnings (#14903) * accounts: fix megacheck warnings * accounts: don't modify abi in favor of full cleanup --- accounts/keystore/key.go | 8 -------- accounts/keystore/keystore_passphrase.go | 4 ++-- accounts/usbwallet/ledger_hub.go | 9 ++++----- 3 files changed, 6 insertions(+), 15 deletions(-) diff --git a/accounts/keystore/key.go b/accounts/keystore/key.go index ecc955d74d..211fa863d7 100644 --- a/accounts/keystore/key.go +++ b/accounts/keystore/key.go @@ -91,14 +91,6 @@ type cipherparamsJSON struct { IV string `json:"iv"` } -type scryptParamsJSON struct { - N int `json:"n"` - R int `json:"r"` - P int `json:"p"` - DkLen int `json:"dklen"` - Salt string `json:"salt"` -} - func (k *Key) MarshalJSON() (j []byte, err error) { jStruct := plainKeyJSON{ hex.EncodeToString(k.Address[:]), diff --git a/accounts/keystore/keystore_passphrase.go b/accounts/keystore/keystore_passphrase.go index 679fc15d69..535608a600 100644 --- a/accounts/keystore/keystore_passphrase.go +++ b/accounts/keystore/keystore_passphrase.go @@ -140,7 +140,7 @@ func EncryptKey(key *Key, auth string, scryptN, scryptP int) ([]byte, error) { Cipher: "aes-128-ctr", CipherText: hex.EncodeToString(cipherText), CipherParams: cipherParamsJSON, - KDF: "scrypt", + KDF: keyHeaderKDF, KDFParams: scryptParamsJSON, MAC: hex.EncodeToString(mac), } @@ -275,7 +275,7 @@ func getKDFKey(cryptoJSON cryptoJSON, auth string) ([]byte, error) { } dkLen := ensureInt(cryptoJSON.KDFParams["dklen"]) - if cryptoJSON.KDF == "scrypt" { + if cryptoJSON.KDF == keyHeaderKDF { n := ensureInt(cryptoJSON.KDFParams["n"]) r := ensureInt(cryptoJSON.KDFParams["r"]) p := ensureInt(cryptoJSON.KDFParams["p"]) diff --git a/accounts/usbwallet/ledger_hub.go b/accounts/usbwallet/ledger_hub.go index fcbc24c0f5..2b0d56097c 100644 --- a/accounts/usbwallet/ledger_hub.go +++ b/accounts/usbwallet/ledger_hub.go @@ -197,11 +197,10 @@ func (hub *LedgerHub) Subscribe(sink chan<- accounts.WalletEvent) event.Subscrip // is not running). func (hub *LedgerHub) updater() { for { - // Wait for a USB hotplug event (not supported yet) or a refresh timeout - select { - //case <-hub.changes: // reenable on hutplug implementation - case <-time.After(ledgerRefreshCycle): - } + // TODO: Wait for a USB hotplug event (not supported yet) or a refresh timeout + // <-hub.changes + time.Sleep(ledgerRefreshCycle) + // Run the wallet refresher hub.refreshWallets()