accounts/keystore: fixed naming

This commit is contained in:
Marius van der Wijden 2020-04-14 14:07:17 +02:00
parent 61e458ae41
commit 11881e78f3

View file

@ -67,8 +67,8 @@ type KeyStore struct {
updateScope event.SubscriptionScope // Subscription scope tracking current live listeners
updating bool // Whether the event notification loop is running
mu sync.RWMutex
impMu sync.RWMutex // Import Mutex locks the import to prevent two insertions from racing
mu sync.RWMutex
importMu sync.RWMutex // Import Mutex locks the import to prevent two insertions from racing
}
type unlocked struct {
@ -444,8 +444,8 @@ func (ks *KeyStore) Import(keyJSON []byte, passphrase, newPassphrase string) (ac
if err != nil {
return accounts.Account{}, err
}
ks.impMu.Lock()
defer ks.impMu.Unlock()
ks.importMu.Lock()
defer ks.importMu.Unlock()
if ks.cache.hasAddress(key.Address) {
return accounts.Account{}, fmt.Errorf("account already exists")
}
@ -455,8 +455,8 @@ func (ks *KeyStore) Import(keyJSON []byte, passphrase, newPassphrase string) (ac
// ImportECDSA stores the given key into the key directory, encrypting it with the passphrase.
func (ks *KeyStore) ImportECDSA(priv *ecdsa.PrivateKey, passphrase string) (accounts.Account, error) {
key := newKeyFromECDSA(priv)
ks.impMu.Lock()
defer ks.impMu.Unlock()
ks.importMu.Lock()
defer ks.importMu.Unlock()
if ks.cache.hasAddress(key.Address) {
return accounts.Account{}, fmt.Errorf("account already exists")
}