Skip to content

Commit

Permalink
short circuit if delegations isn't active
Browse files Browse the repository at this point in the history
  • Loading branch information
uprendis authored and quan8 committed Nov 18, 2020
1 parent e627a5b commit 2736cfe
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions contracts/sfc/Staker.sol
Original file line number Diff line number Diff line change
Expand Up @@ -430,9 +430,7 @@ contract Stakers is Ownable, StakersConstants, Version {
function _calcDelegationLockupRewards(address delegator, uint256 toStakerID, uint256 fromEpoch, uint256 maxEpochs, bool compound) internal view returns (_RewardsSet memory, uint256, uint256) {
Delegation memory delegation = delegations[delegator][toStakerID];
fromEpoch = withDefault(fromEpoch, delegation.paidUntilEpoch + 1);
assert(delegation.deactivatedTime == 0);

if (delegation.paidUntilEpoch >= fromEpoch) {
if (delegation.amount == 0 || delegation.deactivatedTime != 0 || delegation.paidUntilEpoch >= fromEpoch) {
return (_RewardsSet(0, 0, 0, 0), fromEpoch, 0);
}

Expand Down

0 comments on commit 2736cfe

Please sign in to comment.