Ensure geth --dev accounts are always unlocked

pull/1124/head
Kieran Prasch 2019-07-17 13:43:22 -07:00
parent 0b52cd2c74
commit b37a899c6b
No known key found for this signature in database
GPG Key ID: 199AB839D4125A62
3 changed files with 8 additions and 3 deletions

View File

@ -824,7 +824,7 @@ class StakeHolder(BaseConfiguration):
password=password,
account=checksum_address)
self.__transacting_powers[checksum_address] = transacting_power
transacting_power.activate()
transacting_power.activate(password=password)
def to_configuration_file(self, *args, **kwargs) -> str:
filepath = super().to_configuration_file(modifier=self.funding_account, *args, **kwargs)

View File

@ -277,6 +277,10 @@ class GethClient(Web3Client):
return to_checksum_address(new_account) # cast and validate
def unlock_account(self, address, password):
if self.is_local:
# TODO: Is there a more formalized check here for geth --dev mode?
# Geth --dev accounts are unlocked by default.
return True
return self.w3.geth.personal.unlockAccount(address, password)
def sign_transaction(self, transaction: dict) -> bytes:

View File

@ -170,7 +170,8 @@ def stake(click_config,
choice = click.prompt("Select staking account, or enter 'c' to derive a new one", default='c')
if choice == 'c':
click.confirm("Create new ethereum account for staking?", abort=True)
password = click.prompt("Enter new account password", hide_input=True, confirmation_prompt=True)
if not device:
password = click.prompt("Enter new account password", hide_input=True, confirmation_prompt=True)
staking_address = None # signals to create an account later
else:
try:
@ -178,7 +179,7 @@ def stake(click_config,
except KeyError:
raise click.BadParameter(f"'{choice}' is not a valid command.")
if not password:
if not password and not device:
password = click.prompt(f"Enter password to unlock {staking_address}",
hide_input=True,
confirmation_prompt=False)