Respond to RFCs in PR #1536

pull/1536/head
Kieran R. Prasch 2020-01-02 12:37:56 -08:00
parent 48a347ade9
commit 88386c91f9
4 changed files with 11 additions and 6 deletions

View File

@ -994,7 +994,10 @@ class Worker(NucypherTokenActor):
@property
def token_balance(self) -> NU:
"""Return this worker's current token balance"""
"""
Return this worker's current token balance.
Note: Workers typically do not control any tokens.
"""
balance = int(self.token_agent.get_balance(address=self.__worker_address))
nu_balance = NU(balance, 'NuNit')
return nu_balance

View File

@ -252,7 +252,7 @@ def set_worker(click_config,
if not force:
click.confirm(f"Commit to bonding "
f"worker {worker_address} to staker {client_account} "
f"worker {worker_address} to staker {staking_address} "
f"for a minimum of {STAKEHOLDER.economics.minimum_worker_periods} periods?", abort=True)
STAKEHOLDER.assimilate(checksum_address=client_account, password=password)
@ -427,7 +427,8 @@ def create(click_config,
# Consistency check to prevent the above agreement from going stale.
last_second_current_period = STAKEHOLDER.staking_agent.get_current_period()
if start_period != last_second_current_period + 1:
emitter.echo("Current period advanced before stake was broadcasted. Please try again.")
emitter.echo("Current period advanced before stake was broadcasted. Please try again.",
color='red')
raise click.Abort
# Authenticate and Execute
@ -593,7 +594,8 @@ def divide(click_config,
# Consistency check to prevent the above agreement from going stale.
last_second_current_period = STAKEHOLDER.staking_agent.get_current_period()
if action_period != last_second_current_period:
emitter.echo("Current period advanced before stake division was broadcasted. Please try again.")
emitter.echo("Current period advanced before stake division was broadcasted. Please try again.",
red='red')
raise click.Abort
# Execute

View File

@ -420,7 +420,7 @@ def paint_stakes(emitter, stakes, paint_inactive: bool = False):
emitter.echo(header, bold=True)
emitter.echo(breaky, bold=True)
for stake in sorted([s for s in stakes if s not in active_stakes], # TODO
for stake in sorted([s for s in stakes if s not in active_stakes], # TODO: Code optimization here..?
key=lambda some_stake: some_stake.address_index_ordering_key):
row = prettify_stake(stake=stake, index=None)
emitter.echo(row, color='red')

View File

@ -40,7 +40,7 @@ WebEmitter._crash_on_error_default = True
LOCK_FUNCTION = TransactingPower.lock_account
TransactingPower.lock_account = lambda *a, **k: True
# Disable any hardcoded preferred teaches during tests.
# Disable any hardcoded preferred teachers during tests.
TEACHER_NODES = dict()