core: remove voter reward per committee properly
(*Simple).Seek cuts search prefix, thus to remove voterRewardPerCommittee we need to append it again to the height value. May affect dumps.
This commit is contained in:
parent
10acdbe40e
commit
aaf7c423b4
1 changed files with 1 additions and 5 deletions
|
@ -585,15 +585,11 @@ func (n *NEO) dropCandidateIfZero(d *dao.Simple, pub *keys.PublicKey, c *candida
|
|||
}
|
||||
d.DeleteStorageItem(n.ID, makeValidatorKey(pub))
|
||||
|
||||
var toRemove []string
|
||||
voterKey := makeVoterKey(pub.Bytes())
|
||||
d.Seek(n.ID, storage.SeekRange{Prefix: voterKey}, func(k, v []byte) bool {
|
||||
toRemove = append(toRemove, string(k))
|
||||
d.DeleteStorageItem(n.ID, append(voterKey, k...)) // d.Seek cuts prefix, thus need to append it again.
|
||||
return true
|
||||
})
|
||||
for i := range toRemove {
|
||||
d.DeleteStorageItem(n.ID, []byte(toRemove[i]))
|
||||
}
|
||||
delete(n.gasPerVoteCache, string(voterKey))
|
||||
|
||||
return true, nil
|
||||
|
|
Loading…
Reference in a new issue