Skip to content

Commit

Permalink
consensus/parlia: change the rand seed for backOffTime
Browse files Browse the repository at this point in the history
  • Loading branch information
NathanBSC committed Jul 19, 2024
1 parent 6589d44 commit bd82176
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion consensus/parlia/parlia.go
Original file line number Diff line number Diff line change
Expand Up @@ -2022,7 +2022,11 @@ func (p *Parlia) backOffTime(snap *Snapshot, header *types.Header, val common.Ad
return 0
}

s := rand.NewSource(int64(snap.Number))
randSeed := snap.Number
if p.chainConfig.IsBohr(header.Number, header.Time) {
randSeed = header.Number.Uint64() / uint64(snap.TurnLength)
}
s := rand.NewSource(int64(randSeed))
r := rand.New(s)
n := len(validators)
backOffSteps := make([]uint64, 0, n)
Expand Down

0 comments on commit bd82176

Please sign in to comment.