Fix keyring checksum address multiple kwarg passing, add withdraw of inflation rewards to specified account or funding account. Touch up reward collection assertions.

pull/1124/head
Kieran Prasch 2019-07-16 21:53:44 -07:00
parent 7508dc24c3
commit c0f166e56a
No known key found for this signature in database
GPG Key ID: 199AB839D4125A62
4 changed files with 13 additions and 13 deletions

View File

@ -1099,6 +1099,15 @@ class StakeHolder(BaseConfiguration):
if staking:
receipts['staking_reward'] = staker.collect_staking_reward()
# TODO: Do we need an option to skip this step?
# Send ether rewards to the funding or withdraw account.
tx = {'to': withdraw_address or self.funding_account,
'from': staker.checksum_address,
'value': self.eth_funding}
txhash = self.blockchain.client.send_transaction(transaction=tx)
_ether_transfer_receipt = self.blockchain.client.wait_for_receipt(txhash, timeout=120) # TODO: Include in config?
if policy:
withdraw_address = withdraw_address or self.funding_account
receipts['policy_reward'] = staker.collect_policy_reward(collector_address=withdraw_address)

View File

@ -419,7 +419,7 @@ class NuCypherGethDevProcess(NuCypherGethProcess):
_CHAIN_NAME = 'poa-development'
def __init__(self, config_root: str = None, block_time: int = None, *args, **kwargs):
def __init__(self, config_root: str = None, *args, **kwargs):
base_dir = config_root if config_root else DEFAULT_CONFIG_ROOT
base_dir = os.path.join(base_dir, '.ethereum')
@ -430,13 +430,8 @@ class NuCypherGethDevProcess(NuCypherGethProcess):
'data_dir': self.data_dir}
super().__init__(geth_kwargs=self.geth_kwargs, *args, **kwargs)
self.command = [*self.command, '--dev']
self.block_time = int(block_time)
if self.block_time:
self.command.append(f'--dev.period {self.block_time}')
def start(self, timeout: int = 30, extra_delay: int = 1):
if not self.is_running:
self.LOG.info("STARTING GETH DEV PROCESS NOW")

View File

@ -405,7 +405,7 @@ class CharacterConfiguration(BaseConfiguration):
def write_keyring(self, password: str, checksum_address: str = None, **generation_kwargs) -> NucypherKeyring:
if self.federated_only:
generation_kwargs['checksum_address'] = FEDERATED_ADDRESS
checksum_address = FEDERATED_ADDRESS
elif not checksum_address:

View File

@ -339,8 +339,6 @@ def test_collect_rewards_integration(click_runner,
# The staker is staking.
assert staker.stakes
assert staker.is_staking
pre_stake_token_balance = staker.token_balance
assert staker.worker_address == worker_address
ursula_port = select_test_port()
@ -500,7 +498,5 @@ def test_collect_rewards_integration(click_runner,
catch_exceptions=False)
assert result.exit_code == 0
# Staking Reward
calculated_reward = staker.staking_agent.calculate_staking_reward(staker_address=staker.worker_address)
assert calculated_reward
assert staker.token_agent.get_balance(address=burner_wallet) == calculated_reward
# The burner wallet has the reward ethers
assert staker.token_agent.get_balance(address=burner_wallet.address)