Skip to content

Commit a895cc6

Browse files
authored
refactor: use the built-in max/min to simplify the code (#3844)
Signed-off-by: evenevent <digping@icloud.com>
1 parent a353b45 commit a895cc6

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

vms/platformvm/reward/calculator.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,7 @@ func (c *calculator) Calculate(stakedDuration time.Duration, stakedAmount, curre
6363
}
6464

6565
finalReward := reward.Uint64()
66-
if finalReward > remainingSupply {
67-
return remainingSupply
68-
}
69-
70-
return finalReward
66+
return min(remainingSupply, finalReward)
7167
}
7268

7369
// Split [totalAmount] into [totalAmount * shares percentage] and the remainder.

0 commit comments

Comments
 (0)