Created
July 16, 2018 20:26
-
-
Save tommling/5c17d088f6a58a0444607831a39c175c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def validator_stake_amount_is_low(self, | |
validator_info, | |
block_number, | |
state_view): | |
""" | |
:param validator_info: | |
:param block_number: | |
:param state_view: | |
:return: | |
""" | |
# We need to retrieve this from the settings ideally, | |
minimum_stake_amt = self.MIN_STAKE_AMT | |
# initialize the current consensus state so we can retrieve | |
# fresh information about the current validator's stake | |
stake = StakeView(state_view) | |
# good, now we can look up their stake address | |
key = validator_info.signup_info.poet_public_key | |
# returns a tuple (float, int) representing the value at the | |
# location and the block_number its locked for | |
stake_value, block_num = stake.get_stake(key) | |
# consensus_state = consensus_state_store.get(block_id=current_id) | |
# stake_value, block_num = chronoshift_stake_view.get_stake(key) | |
# if the stake is grater than the minimum and it is locked i.e., | |
# the locked blockNum is greater or equal to the current block_number. | |
if stake_value < minimum_stake_amt and block_num >= block_number: | |
return True | |
return False |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment