mirror of https://github.com/nucypher/nucypher.git
Fix keyring checksum address multiple kwarg passing, add withdraw of inflation rewards to specified account or funding account. Touch up reward collection assertions.
parent
7508dc24c3
commit
c0f166e56a
|
@ -1099,6 +1099,15 @@ class StakeHolder(BaseConfiguration):
|
||||||
if staking:
|
if staking:
|
||||||
receipts['staking_reward'] = staker.collect_staking_reward()
|
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:
|
if policy:
|
||||||
withdraw_address = withdraw_address or self.funding_account
|
withdraw_address = withdraw_address or self.funding_account
|
||||||
receipts['policy_reward'] = staker.collect_policy_reward(collector_address=withdraw_address)
|
receipts['policy_reward'] = staker.collect_policy_reward(collector_address=withdraw_address)
|
||||||
|
|
|
@ -419,7 +419,7 @@ class NuCypherGethDevProcess(NuCypherGethProcess):
|
||||||
|
|
||||||
_CHAIN_NAME = 'poa-development'
|
_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 = config_root if config_root else DEFAULT_CONFIG_ROOT
|
||||||
base_dir = os.path.join(base_dir, '.ethereum')
|
base_dir = os.path.join(base_dir, '.ethereum')
|
||||||
|
@ -430,13 +430,8 @@ class NuCypherGethDevProcess(NuCypherGethProcess):
|
||||||
'data_dir': self.data_dir}
|
'data_dir': self.data_dir}
|
||||||
|
|
||||||
super().__init__(geth_kwargs=self.geth_kwargs, *args, **kwargs)
|
super().__init__(geth_kwargs=self.geth_kwargs, *args, **kwargs)
|
||||||
|
|
||||||
self.command = [*self.command, '--dev']
|
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):
|
def start(self, timeout: int = 30, extra_delay: int = 1):
|
||||||
if not self.is_running:
|
if not self.is_running:
|
||||||
self.LOG.info("STARTING GETH DEV PROCESS NOW")
|
self.LOG.info("STARTING GETH DEV PROCESS NOW")
|
||||||
|
|
|
@ -405,7 +405,7 @@ class CharacterConfiguration(BaseConfiguration):
|
||||||
def write_keyring(self, password: str, checksum_address: str = None, **generation_kwargs) -> NucypherKeyring:
|
def write_keyring(self, password: str, checksum_address: str = None, **generation_kwargs) -> NucypherKeyring:
|
||||||
|
|
||||||
if self.federated_only:
|
if self.federated_only:
|
||||||
generation_kwargs['checksum_address'] = FEDERATED_ADDRESS
|
checksum_address = FEDERATED_ADDRESS
|
||||||
|
|
||||||
elif not checksum_address:
|
elif not checksum_address:
|
||||||
|
|
||||||
|
|
|
@ -339,8 +339,6 @@ def test_collect_rewards_integration(click_runner,
|
||||||
# The staker is staking.
|
# The staker is staking.
|
||||||
assert staker.stakes
|
assert staker.stakes
|
||||||
assert staker.is_staking
|
assert staker.is_staking
|
||||||
pre_stake_token_balance = staker.token_balance
|
|
||||||
|
|
||||||
assert staker.worker_address == worker_address
|
assert staker.worker_address == worker_address
|
||||||
|
|
||||||
ursula_port = select_test_port()
|
ursula_port = select_test_port()
|
||||||
|
@ -500,7 +498,5 @@ def test_collect_rewards_integration(click_runner,
|
||||||
catch_exceptions=False)
|
catch_exceptions=False)
|
||||||
assert result.exit_code == 0
|
assert result.exit_code == 0
|
||||||
|
|
||||||
# Staking Reward
|
# The burner wallet has the reward ethers
|
||||||
calculated_reward = staker.staking_agent.calculate_staking_reward(staker_address=staker.worker_address)
|
assert staker.token_agent.get_balance(address=burner_wallet.address)
|
||||||
assert calculated_reward
|
|
||||||
assert staker.token_agent.get_balance(address=burner_wallet) == calculated_reward
|
|
||||||
|
|
Loading…
Reference in New Issue