mirror of https://github.com/nucypher/nucypher.git
Fixes #1283 - Allow staking to maximum amount per address.
parent
69b41a7b5b
commit
307bfe3ad6
|
@ -515,8 +515,9 @@ class Staker(NucypherTokenActor):
|
|||
|
||||
# Ensure the new stake will not exceed the staking limit
|
||||
if (self.current_stake + amount) > self.economics.maximum_allowed_locked:
|
||||
raise Stake.StakingError(f"Cannot divide stake - "
|
||||
f"Maximum stake value exceeded with a target value of {amount}.")
|
||||
raise Stake.StakingError(f"Cannot initialize stake - "
|
||||
f"Maximum stake value exceeded for {self.checksum_address} "
|
||||
f"with a target value of {amount}.")
|
||||
|
||||
# Write to blockchain
|
||||
new_stake = Stake.initialize_stake(staker=self,
|
||||
|
|
|
@ -1447,11 +1447,10 @@ class StakeHolder(Staker):
|
|||
return stakes
|
||||
|
||||
@property
|
||||
def current_stake(self) -> NU:
|
||||
def total_stake(self) -> NU:
|
||||
"""
|
||||
The total number of staked tokens, either locked or unlocked in the current period.
|
||||
"""
|
||||
# TODO: This is skipping a layer. Fix me?
|
||||
stake = sum(self.staking_agent.owned_tokens(staker_address=account) for account in self.wallet.accounts)
|
||||
nu_stake = NU.from_nunits(stake)
|
||||
return nu_stake
|
||||
|
|
|
@ -20,7 +20,6 @@ from nucypher.utilities.sandbox.constants import (
|
|||
TEST_PROVIDER_URI,
|
||||
MOCK_URSULA_STARTING_PORT,
|
||||
INSECURE_DEVELOPMENT_PASSWORD,
|
||||
MOCK_REGISTRY_FILEPATH,
|
||||
TEMPORARY_DOMAIN,
|
||||
MOCK_KNOWN_URSULAS_CACHE,
|
||||
select_test_port,
|
||||
|
|
Loading…
Reference in New Issue