mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2025-05-07 15:07:36 +00:00
stackitem: properly detect recursive references during serialization
If we're done with element it no longer can lead to recursion error, so fix cases like `[arr, arr]` where we have two copies of `arr` trigger this error for no good reason (there is no recursion there).
This commit is contained in:
parent
ae8f4ebd5e
commit
6879cbcdcc
2 changed files with 4 additions and 0 deletions
|
@ -82,6 +82,7 @@ func serializeItemTo(item Item, w *io.BinWriter, allowInvalid bool, seen map[Ite
|
|||
for i := range arr {
|
||||
serializeItemTo(arr[i], w, allowInvalid, seen)
|
||||
}
|
||||
delete(seen, item)
|
||||
case *Map:
|
||||
seen[item] = true
|
||||
|
||||
|
@ -91,6 +92,7 @@ func serializeItemTo(item Item, w *io.BinWriter, allowInvalid bool, seen map[Ite
|
|||
serializeItemTo(t.Value().([]MapElement)[i].Key, w, allowInvalid, seen)
|
||||
serializeItemTo(t.Value().([]MapElement)[i].Value, w, allowInvalid, seen)
|
||||
}
|
||||
delete(seen, item)
|
||||
case Null:
|
||||
w.WriteB(byte(AnyT))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue