core: deepcopy notification in System.Runtime.Notify

Make it impossible to change already emitted notifications via
`System.Runtime.GetNotifications`.
This commit is contained in:
Evgenii Stratonikov 2020-08-04 10:13:36 +03:00
parent b8cc33d0b2
commit 194da64975
2 changed files with 2 additions and 2 deletions

View file

@ -47,7 +47,7 @@ func GetNotifications(ic *interop.Context, v *vm.VM) error {
ev := stackitem.NewArray([]stackitem.Item{
stackitem.NewByteArray(notifications[i].ScriptHash.BytesBE()),
stackitem.Make(notifications[i].Name),
notifications[i].Item,
stackitem.DeepCopy(notifications[i].Item).(*stackitem.Array),
})
arr.Append(ev)
}

View file

@ -282,7 +282,7 @@ func runtimeNotify(ic *interop.Context, v *vm.VM) error {
ne := state.NotificationEvent{
ScriptHash: v.GetCurrentScriptHash(),
Name: name,
Item: stackitem.NewArray(args),
Item: stackitem.DeepCopy(stackitem.NewArray(args)).(*stackitem.Array),
}
ic.Notifications = append(ic.Notifications, ne)
return nil