interop/runtime: disable notifications in dynamic scripts

That are only entry scripts today. See neo-project/neo#2796.
This commit is contained in:
Roman Khimov 2022-07-27 14:49:53 +03:00
parent 1ff588a11b
commit e5c59f8ddd
2 changed files with 16 additions and 1 deletions

View file

@ -73,6 +73,10 @@ func Notify(ic *interop.Context) error {
if len(name) > MaxEventNameLen {
return fmt.Errorf("event name must be less than %d", MaxEventNameLen)
}
if ic.VM.Context().NEF == nil {
return errors.New("notifications are not allowed in dynamic scripts")
}
// But it has to be serializable, otherwise we either have some broken
// (recursive) structure inside or an interop item that can't be used
// outside of the interop subsystem anyway.