core: fix nondeterministic txGetReferences() behavior

Ranging over map is nondeterministic and contracts may be unprepared for
that. Fixes #454.
This commit is contained in:
Roman Khimov 2019-11-14 16:09:57 +03:00
parent 5e8122bfac
commit 01082a8988

View file

@ -144,8 +144,8 @@ func (ic *interopContext) txGetReferences(v *vm.VM) error {
}
stackrefs := make([]vm.StackItem, 0, len(refs))
for k, v := range refs {
tio := txInOut{k, *v}
for _, k := range tx.Inputs {
tio := txInOut{*k, *refs[*k]}
stackrefs = append(stackrefs, vm.NewInteropItem(tio))
}
v.Estack().PushVal(stackrefs)