accounts: fix megacheck warnings (#14903)

* accounts: fix megacheck warnings

* accounts: don't modify abi in favor of full cleanup
This commit is contained in:
Egon Elbre 2017-08-07 14:11:15 +03:00 committed by Péter Szilágyi
parent f7848c2aa5
commit 7c74e166b0
3 changed files with 6 additions and 15 deletions

View File

@ -91,14 +91,6 @@ type cipherparamsJSON struct {
IV string `json:"iv"` 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) { func (k *Key) MarshalJSON() (j []byte, err error) {
jStruct := plainKeyJSON{ jStruct := plainKeyJSON{
hex.EncodeToString(k.Address[:]), hex.EncodeToString(k.Address[:]),

View File

@ -140,7 +140,7 @@ func EncryptKey(key *Key, auth string, scryptN, scryptP int) ([]byte, error) {
Cipher: "aes-128-ctr", Cipher: "aes-128-ctr",
CipherText: hex.EncodeToString(cipherText), CipherText: hex.EncodeToString(cipherText),
CipherParams: cipherParamsJSON, CipherParams: cipherParamsJSON,
KDF: "scrypt", KDF: keyHeaderKDF,
KDFParams: scryptParamsJSON, KDFParams: scryptParamsJSON,
MAC: hex.EncodeToString(mac), MAC: hex.EncodeToString(mac),
} }
@ -275,7 +275,7 @@ func getKDFKey(cryptoJSON cryptoJSON, auth string) ([]byte, error) {
} }
dkLen := ensureInt(cryptoJSON.KDFParams["dklen"]) dkLen := ensureInt(cryptoJSON.KDFParams["dklen"])
if cryptoJSON.KDF == "scrypt" { if cryptoJSON.KDF == keyHeaderKDF {
n := ensureInt(cryptoJSON.KDFParams["n"]) n := ensureInt(cryptoJSON.KDFParams["n"])
r := ensureInt(cryptoJSON.KDFParams["r"]) r := ensureInt(cryptoJSON.KDFParams["r"])
p := ensureInt(cryptoJSON.KDFParams["p"]) p := ensureInt(cryptoJSON.KDFParams["p"])

View File

@ -197,11 +197,10 @@ func (hub *LedgerHub) Subscribe(sink chan<- accounts.WalletEvent) event.Subscrip
// is not running). // is not running).
func (hub *LedgerHub) updater() { func (hub *LedgerHub) updater() {
for { for {
// Wait for a USB hotplug event (not supported yet) or a refresh timeout // TODO: Wait for a USB hotplug event (not supported yet) or a refresh timeout
select { // <-hub.changes
//case <-hub.changes: // reenable on hutplug implementation time.Sleep(ledgerRefreshCycle)
case <-time.After(ledgerRefreshCycle):
}
// Run the wallet refresher // Run the wallet refresher
hub.refreshWallets() hub.refreshWallets()