vm: convert items to UTF-8 strings

Add `stackitem.ToString` for seamless string conversion.
This commit is contained in:
Evgenii Stratonikov 2020-07-29 11:18:51 +03:00
parent 82692d8d21
commit f40aba4cd0
9 changed files with 41 additions and 26 deletions

View file

@ -62,7 +62,7 @@ func getLogHandler(logs *[]string) vm.SyscallHandler {
return errors.New("syscall not found")
}
msg := string(v.Estack().Pop().Bytes())
msg := v.Estack().Pop().String()
*logs = append(*logs, msg)
return nil
}

View file

@ -128,7 +128,7 @@ func (s *storagePlugin) syscallHandler(v *vm.VM, id uint32) error {
}
func (s *storagePlugin) Notify(v *vm.VM) error {
name := string(v.Estack().Pop().Bytes())
name := v.Estack().Pop().String()
item := stackitem.NewArray(v.Estack().Pop().Array())
s.events = append(s.events, state.NotificationEvent{
Name: name,