[#201] reputation: Fix migration routine

1. Ignore keys unrelated to reputation values
2. Remove legacy `contractOwner` key
3. Remove reinitialized data

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
Alex Vanin 2021-12-10 16:01:46 +03:00 committed by Alex Vanin
parent 59eb422a72
commit 486e39d025

View file

@ -23,12 +23,19 @@ func _deploy(data interface{}, isUpdate bool) {
if isUpdate { if isUpdate {
// Storage migration. // Storage migration.
storage.Delete(ctx, []byte("contractOwner"))
it := storage.Find(ctx, []byte{}, storage.None) it := storage.Find(ctx, []byte{}, storage.None)
for iterator.Next(it) { for iterator.Next(it) {
kv := iterator.Value(it).([][]byte) kv := iterator.Value(it).([][]byte)
if string(kv[0]) == notaryDisabledKey { if string(kv[0]) == notaryDisabledKey {
continue continue
} }
if string(kv[0]) == "ballots" {
continue
}
storage.Delete(ctx, kv[0])
rawValues := std.Deserialize(kv[1]).([][]byte) rawValues := std.Deserialize(kv[1]).([][]byte)
key := getReputationKey(reputationCountPrefix, kv[0]) key := getReputationKey(reputationCountPrefix, kv[0])