aboutsummaryrefslogtreecommitdiffstats
path: root/accounts/account_manager.go
diff options
context:
space:
mode:
authorJeffrey Wilcke <geffobscura@gmail.com>2016-05-03 19:52:58 +0800
committerJeffrey Wilcke <geffobscura@gmail.com>2016-05-03 19:52:58 +0800
commitd52a693f802ce4445cc02a879646ca5466fb2a06 (patch)
tree0e3a017c071c8996d7470f5477087ee201ce2da2 /accounts/account_manager.go
parent8241fa522772837f0d05511f20caa6da1d5a3209 (diff)
parent258cc73ea970890a5b75bf27197c3a6667f3bc5a (diff)
downloadgo-tangerine-d52a693f802ce4445cc02a879646ca5466fb2a06.tar
go-tangerine-d52a693f802ce4445cc02a879646ca5466fb2a06.tar.gz
go-tangerine-d52a693f802ce4445cc02a879646ca5466fb2a06.tar.bz2
go-tangerine-d52a693f802ce4445cc02a879646ca5466fb2a06.tar.lz
go-tangerine-d52a693f802ce4445cc02a879646ca5466fb2a06.tar.xz
go-tangerine-d52a693f802ce4445cc02a879646ca5466fb2a06.tar.zst
go-tangerine-d52a693f802ce4445cc02a879646ca5466fb2a06.zip
Merge branch 'develop' into release/1.4
Conflicts: cmd/geth/main.go
Diffstat (limited to 'accounts/account_manager.go')
-rw-r--r--accounts/account_manager.go7
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) {