Merge pull request #2764 from derekpierre/remove-expired-stakers

Don't include stakers with expired stakes in the `missing_stakers` results for `StakingEscrowAgent.partition_stakers_by_activity()`
pull/2771/head
Derek Pierre 2021-07-30 08:38:12 -04:00 committed by GitHub
commit 614e4fa792
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 0 deletions

View File

@ -0,0 +1 @@
``StakingEscrow.partition_stakers_by_activity()`` no longer includes stakers with expired stakes in the ``missing_stakers`` value returned, thereby no longer overstating the number of inactive stakers.

View File

@ -301,6 +301,10 @@ class StakingEscrowAgent(EthereumContractAgent):
elif last_committed_period == current_period:
pending_stakers.append(staker)
else:
locked_stake = self.non_withdrawable_stake(staker_address=staker)
if locked_stake == 0:
# don't include stakers with expired stakes
continue
missing_stakers.append(staker)
return active_stakers, pending_stakers, missing_stakers