diff options
author | Felix Lange <fjl@twurst.com> | 2016-04-30 05:09:37 +0800 |
---|---|---|
committer | Felix Lange <fjl@twurst.com> | 2016-04-30 05:09:37 +0800 |
commit | 1c20313a6a1a35d5f540f878e7c263327c2ccfc1 (patch) | |
tree | 4835cd7f3085edb6c6ed41b62edf15be9f9e42dc /accounts | |
parent | cfa999f006c30613aa4acce42d8edad056f39c10 (diff) | |
parent | 572da73d4d475db0443f457d9383a3d513f189ee (diff) | |
download | go-tangerine-1c20313a6a1a35d5f540f878e7c263327c2ccfc1.tar.gz go-tangerine-1c20313a6a1a35d5f540f878e7c263327c2ccfc1.tar.zst go-tangerine-1c20313a6a1a35d5f540f878e7c263327c2ccfc1.zip |
Merge pull request #2493 from almindor/develop
eth: add personal_importRawKey
Diffstat (limited to 'accounts')
-rw-r--r-- | accounts/account_manager.go | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/accounts/account_manager.go b/accounts/account_manager.go index 56499672e..3afadf6b2 100644 --- a/accounts/account_manager.go +++ b/accounts/account_manager.go @@ -284,7 +284,12 @@ func (am *Manager) Import(keyJSON []byte, passphrase, newPassphrase string) (Acc // ImportECDSA stores the given key into the key directory, encrypting it with the passphrase. func (am *Manager) ImportECDSA(priv *ecdsa.PrivateKey, passphrase string) (Account, error) { - return am.importKey(newKeyFromECDSA(priv), passphrase) + key := newKeyFromECDSA(priv) + if am.cache.hasAddress(key.Address) { + return Account{}, fmt.Errorf("account already exists") + } + + return am.importKey(key, passphrase) } func (am *Manager) importKey(key *Key, passphrase string) (Account, error) { |