Skip to content

Commit

Permalink
Fix candidates import
Browse files Browse the repository at this point in the history
  • Loading branch information
danil-lashin committed Apr 7, 2020
1 parent 5b48209 commit eb86074
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion core/state/candidates/candidates.go
Original file line number Diff line number Diff line change
Expand Up @@ -821,7 +821,21 @@ func (c *Candidates) SetStakes(pubkey types.Pubkey, stakes []types.Stake, update
})
}

for i, s := range stakes {
count := len(stakes)
if count > MaxDelegatorsPerCandidate {
count = MaxDelegatorsPerCandidate

for _, u := range stakes[1000:] {
candidate.addUpdate(&Stake{
Owner: u.Owner,
Coin: u.Coin,
Value: helpers.StringToBigInt(u.Value),
BipValue: helpers.StringToBigInt(u.BipValue),
})
}
}

for i, s := range stakes[:count] {
candidate.stakes[i] = &Stake{
Owner: s.Owner,
Coin: s.Coin,
Expand Down

0 comments on commit eb86074

Please sign in to comment.