From a980cac0b3b76dd9a59b86f8d752f926c072d13f Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Thu, 18 Jun 2020 23:22:15 +0300 Subject: [PATCH] stackitem: support Null item (de-)serialization It's binary representation contains just type (AnyT). --- pkg/vm/stackitem/serialization.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/vm/stackitem/serialization.go b/pkg/vm/stackitem/serialization.go index e6cd51d90..17b3dec95 100644 --- a/pkg/vm/stackitem/serialization.go +++ b/pkg/vm/stackitem/serialization.go @@ -70,6 +70,8 @@ func serializeItemTo(item Item, w *io.BinWriter, seen map[Item]bool) { serializeItemTo(t.Value().([]MapElement)[i].Key, w, seen) serializeItemTo(t.Value().([]MapElement)[i].Value, w, seen) } + case Null: + w.WriteB(byte(AnyT)) } } @@ -127,6 +129,8 @@ func DecodeBinaryStackItem(r *io.BinReader) Item { m.Add(key, value) } return m + case AnyT: + return Null{} default: r.Err = errors.New("unknown type") return nil