eth: add personal_importRawKey for runtime private key import

This commit is contained in:
Ales Katona
2016-04-25 11:23:40 -06:00
parent 70b8b54cd2
commit 572da73d4d
3 changed files with 38 additions and 7 deletions

View File

@ -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) {