Skip to content

Commit

Permalink
fix adding empty List/HashList to empty HashList (#98)
Browse files Browse the repository at this point in the history
  • Loading branch information
tersec authored Oct 6, 2024
1 parent 11b390a commit 6688301
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion ssz_serialization/types.nim
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,9 @@ template len*(a: type HashArray): auto = int(a.maxLen)
func add*(x: var HashList, val: auto): bool =
if add(x.data, val):
x.resizeHashes()
clearCaches(x, x.data.len() - 1)
if x.data.len() > 0:
# Otherwise, adding an empty list to an empty list fails
clearCaches(x, x.data.len() - 1)
true
else:
false
Expand Down

0 comments on commit 6688301

Please sign in to comment.