From 486e39d025f34ecd26bcef03bbce76b61d7ec2ab Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Fri, 10 Dec 2021 16:01:46 +0300 Subject: [PATCH] [#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 --- reputation/reputation_contract.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/reputation/reputation_contract.go b/reputation/reputation_contract.go index 946d352..a49475f 100644 --- a/reputation/reputation_contract.go +++ b/reputation/reputation_contract.go @@ -23,12 +23,19 @@ func _deploy(data interface{}, isUpdate bool) { if isUpdate { // Storage migration. + storage.Delete(ctx, []byte("contractOwner")) + it := storage.Find(ctx, []byte{}, storage.None) for iterator.Next(it) { kv := iterator.Value(it).([][]byte) if string(kv[0]) == notaryDisabledKey { continue } + if string(kv[0]) == "ballots" { + continue + } + + storage.Delete(ctx, kv[0]) rawValues := std.Deserialize(kv[1]).([][]byte) key := getReputationKey(reputationCountPrefix, kv[0])