better error message
This commit is contained in:
parent
5c59b017ae
commit
74d26f5bdc
|
@ -331,9 +331,9 @@ class Commands:
|
||||||
"""Import a private key. """
|
"""Import a private key. """
|
||||||
try:
|
try:
|
||||||
addr = self.wallet.import_key(privkey, self.password)
|
addr = self.wallet.import_key(privkey, self.password)
|
||||||
out = "Keypair imported: ", addr
|
out = "Keypair imported: " + addr
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
out = "Error: Keypair import failed: " + str(e)
|
out = "Error: " + str(e)
|
||||||
return out
|
return out
|
||||||
|
|
||||||
def _resolver(self, x):
|
def _resolver(self, x):
|
||||||
|
|
|
@ -291,7 +291,7 @@ class Abstract_Wallet(object):
|
||||||
return account is not None
|
return account is not None
|
||||||
|
|
||||||
def import_key(self, sec, password):
|
def import_key(self, sec, password):
|
||||||
assert self.can_import()
|
assert self.can_import(), 'This wallet cannot import private keys'
|
||||||
try:
|
try:
|
||||||
pubkey = public_key_from_private_key(sec)
|
pubkey = public_key_from_private_key(sec)
|
||||||
address = public_key_to_bc_address(pubkey.decode('hex'))
|
address = public_key_to_bc_address(pubkey.decode('hex'))
|
||||||
|
|
Loading…
Reference in New Issue