mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
ckeck account already exists or not When import keystore
This commit is contained in:
parent
8c1e8de839
commit
cf27bc244f
1 changed files with 3 additions and 0 deletions
|
|
@ -443,6 +443,9 @@ func (ks *KeyStore) Import(keyJSON []byte, passphrase, newPassphrase string) (ac
|
|||
if err != nil {
|
||||
return accounts.Account{}, err
|
||||
}
|
||||
if ks.cache.hasAddress(key.Address) {
|
||||
return accounts.Account{}, fmt.Errorf("account already exists")
|
||||
}
|
||||
return ks.importKey(key, newPassphrase)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue