vm: rework Map with internal slice representation

Which makes iterating over map stable which is important for serialization and
and even fixes occasional test failures. We use the same ordering here as
NEO 3.0 uses, but it should also be fine for NEO 2.0 because it has no
defined order.
This commit is contained in:
Roman Khimov 2020-03-31 13:30:38 +03:00
parent 25201d480d
commit 2d0ad30fcf
9 changed files with 91 additions and 105 deletions

View file

@ -228,8 +228,8 @@ func (s *Stack) updateSizeAdd(item StackItem) {
s.updateSizeAdd(it)
}
case *MapItem:
for _, v := range t.value {
s.updateSizeAdd(v)
for i := range t.value {
s.updateSizeAdd(t.value[i].Value)
}
}
}
@ -253,8 +253,8 @@ func (s *Stack) updateSizeRemove(item StackItem) {
s.updateSizeRemove(it)
}
case *MapItem:
for _, v := range t.value {
s.updateSizeRemove(v)
for i := range t.value {
s.updateSizeRemove(t.value[i].Value)
}
}
}