accounts: use errors instead of fmt

This commit is contained in:
Marius van der Wijden 2020-04-21 16:13:04 +02:00
parent abce8e55e7
commit 1b3d58428a

View file

@ -24,7 +24,6 @@ import (
"crypto/ecdsa" "crypto/ecdsa"
crand "crypto/rand" crand "crypto/rand"
"errors" "errors"
"fmt"
"math/big" "math/big"
"os" "os"
"path/filepath" "path/filepath"
@ -447,7 +446,7 @@ func (ks *KeyStore) Import(keyJSON []byte, passphrase, newPassphrase string) (ac
ks.importMu.Lock() ks.importMu.Lock()
defer ks.importMu.Unlock() defer ks.importMu.Unlock()
if ks.cache.hasAddress(key.Address) { if ks.cache.hasAddress(key.Address) {
return accounts.Account{}, fmt.Errorf("account already exists") return accounts.Account{}, errors.New("account already exists")
} }
return ks.importKey(key, newPassphrase) return ks.importKey(key, newPassphrase)
} }
@ -458,7 +457,7 @@ func (ks *KeyStore) ImportECDSA(priv *ecdsa.PrivateKey, passphrase string) (acco
ks.importMu.Lock() ks.importMu.Lock()
defer ks.importMu.Unlock() defer ks.importMu.Unlock()
if ks.cache.hasAddress(key.Address) { if ks.cache.hasAddress(key.Address) {
return accounts.Account{}, fmt.Errorf("account already exists") return accounts.Account{}, errors.New("account already exists")
} }
return ks.importKey(key, passphrase) return ks.importKey(key, passphrase)
} }