-
Notifications
You must be signed in to change notification settings - Fork 197
/
ratingStepData.go
58 lines (49 loc) · 1.97 KB
/
ratingStepData.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
package rating
import (
"github.com/ElrondNetwork/elrond-go/process"
)
var _ process.RatingsStepHandler = (*RatingStep)(nil)
// RatingStep will store information about ratingsComputation specific for a shard or metachain
type RatingStep struct {
proposerIncreaseRatingStep int32
proposerDecreaseRatingStep int32
validatorIncreaseRatingStep int32
validatorDecreaseRatingStep int32
consecutiveMissedBlocksPenalty float32
}
// NewRatingStepData creates a new RatingStep instance
func NewRatingStepData(
proposerIncreaseRatingStep int32,
proposerDecreaseRatingStep int32,
validatorIncreaseRatingStep int32,
validatorDecreaseRatingStep int32,
consecutiveMissedBlocksPenalty float32,
) process.RatingsStepHandler {
return &RatingStep{
proposerIncreaseRatingStep: proposerIncreaseRatingStep,
proposerDecreaseRatingStep: proposerDecreaseRatingStep,
validatorIncreaseRatingStep: validatorIncreaseRatingStep,
validatorDecreaseRatingStep: validatorDecreaseRatingStep,
consecutiveMissedBlocksPenalty: consecutiveMissedBlocksPenalty,
}
}
// ProposerIncreaseRatingStep will return the rating step increase for validator
func (rd *RatingStep) ProposerIncreaseRatingStep() int32 {
return rd.proposerIncreaseRatingStep
}
// ProposerDecreaseRatingStep will return the rating step decrease for proposer
func (rd *RatingStep) ProposerDecreaseRatingStep() int32 {
return rd.proposerDecreaseRatingStep
}
// ValidatorIncreaseRatingStep will return the rating step increase for validator
func (rd *RatingStep) ValidatorIncreaseRatingStep() int32 {
return rd.validatorIncreaseRatingStep
}
// ValidatorDecreaseRatingStep will return the rating step decrease for validator
func (rd *RatingStep) ValidatorDecreaseRatingStep() int32 {
return rd.validatorDecreaseRatingStep
}
// ConsecutiveMissedBlocksPenalty will return the penalty increase for consecutive block misses
func (rd *RatingStep) ConsecutiveMissedBlocksPenalty() float32 {
return rd.consecutiveMissedBlocksPenalty
}