diff --git a/pkg/vm/stackitem/serialization.go b/pkg/vm/stackitem/serialization.go index bb802dd36..960cb4252 100644 --- a/pkg/vm/stackitem/serialization.go +++ b/pkg/vm/stackitem/serialization.go @@ -39,6 +39,9 @@ func EncodeBinaryStackItemAppExec(item Item, w *io.BinWriter) { } func serializeItemTo(item Item, w *io.BinWriter, allowInvalid bool, seen map[Item]bool) { + if w.Err != nil { + return + } if seen[item] { w.Err = errors.New("recursive structures can't be serialized") return