Skip to content

Commit

Permalink
Merge pull request #409 from pegnet/develop
Browse files Browse the repository at this point in the history
Version 2.0.3
  • Loading branch information
StarNeit committed Feb 25, 2021
2 parents e59c2d3 + 2333dd3 commit a476b4b
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 20 deletions.
18 changes: 0 additions & 18 deletions modules/graderStake/baseGradedBlock.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
package graderStake

import (
"math/rand"
"time"
)

// baseGradedBlock is an spr set that has been graded
type baseGradedBlock struct {
sprs []*GradingSPR
Expand Down Expand Up @@ -64,17 +59,4 @@ func (b *baseGradedBlock) filterDuplicates() {
b.sprs = filtered
}

// randomize the SPRs order.
func (b *baseGradedBlock) shuffleSPRs() {
r := rand.New(rand.NewSource(time.Now().Unix()))
ret := make([]*GradingSPR, len(b.sprs))
n := len(b.sprs)
for i := 0; i < n; i++ {
randIndex := r.Intn(len(b.sprs))
ret[i] = b.sprs[randIndex]
b.sprs = append(b.sprs[:randIndex], b.sprs[randIndex+1:]...)
}
b.sprs = ret
}

func (b *baseGradedBlock) Cutoff() int { return b.cutoff }
2 changes: 1 addition & 1 deletion modules/graderStake/s2grader.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ type S2BlockGrader struct {

// Version 6
func (s2 *S2BlockGrader) Version() uint8 {
return 6
return 5
}

// WinnerAmount is the number of SPRs that receive a payout
Expand Down
1 change: 0 additions & 1 deletion modules/graderStake/s3grader.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ func (s3 *S3BlockGrader) GradeCustom(cutoff int) GradedBlock {
block.height = s3.height
block.cloneSPRS(s3.sprs)
block.filterDuplicates()
block.shuffleSPRs()
block.grade()
return block
}
Expand Down

0 comments on commit a476b4b

Please sign in to comment.