forked from TrueCloudLab/neoneo-go
core: properly update validator votes for Account descriptor
ValidatorsCount is not implemented yet, but we need to update validators properly, adding account's vote to their votes count.
This commit is contained in:
parent
8310b76d28
commit
2ff7ceb8cf
1 changed files with 8 additions and 9 deletions
|
@ -714,15 +714,14 @@ func processAccountStateDescriptor(descriptor *transaction.StateDescriptor, dao
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
account.Votes = votes
|
account.Votes = votes
|
||||||
if votes.Len() != len(account.Votes) {
|
for _, vote := range account.Votes {
|
||||||
for _, vote := range votes {
|
validatorState, err := dao.GetValidatorStateOrNew(vote)
|
||||||
validator, err := dao.GetValidatorStateOrNew(vote)
|
if err != nil {
|
||||||
if err != nil {
|
return err
|
||||||
return err
|
}
|
||||||
}
|
validatorState.Votes += balance
|
||||||
if err := dao.PutValidatorState(validator); err != nil {
|
if err = dao.PutValidatorState(validatorState); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return dao.PutAccountState(account)
|
return dao.PutAccountState(account)
|
||||||
|
|
Loading…
Reference in a new issue