mirror of
https://github.com/planetmint/planetmint-go.git
synced 2025-03-30 15:08:28 +00:00

* initial refactoring commit * added config passing to network creation for some test suits * fixed refactoring issues * adjusted params Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
36 lines
767 B
Go
36 lines
767 B
Go
package util
|
|
|
|
import (
|
|
"math"
|
|
)
|
|
|
|
var PopsPerCycle float64
|
|
|
|
func init() {
|
|
PopsPerCycle = 1051200.0
|
|
}
|
|
|
|
func GetPopNumber(blockHeight int64, popEpochs int64) float64 {
|
|
return float64(blockHeight) / float64(popEpochs)
|
|
}
|
|
|
|
func GetPopReward(blockHeight int64, popEpochs int64) (total uint64, challenger uint64, challengee uint64) {
|
|
PopNumber := GetPopNumber(blockHeight, popEpochs)
|
|
exactCycleID := PopNumber / PopsPerCycle
|
|
|
|
switch cycleID := math.Floor(exactCycleID); cycleID {
|
|
case 0:
|
|
return 7990867578, 1997716894, 5993150684
|
|
case 1:
|
|
return 3995433789, 998858447, 2996575342
|
|
case 2:
|
|
return 1997716894, 499429223, 1498287671
|
|
case 3:
|
|
return 998858446, 249714611, 749143835
|
|
case 4:
|
|
return 499429222, 124857305, 374571917
|
|
default:
|
|
return 0, 0, 0
|
|
}
|
|
}
|