Skip to content

Commit

Permalink
do not use delete
Browse files Browse the repository at this point in the history
  • Loading branch information
chirag-parmar committed Dec 15, 2024
1 parent 036ceb8 commit bc0089e
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions eth/rlp/hash_writer.nim
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ type
keccak: keccak.keccak256
listLengths*: seq[int]
prefixLengths*: seq[int]
listCount: int

template update(writer: var RlpHashWriter, data: byte) =
writer.keccak.update([data])
Expand Down Expand Up @@ -59,10 +60,10 @@ proc startList*(self: var RlpHashWriter, listSize: int) =
if listSize == 0:
self.writeCount(0, LIST_START_MARKER)
else:
let prefixLen = self.prefixLengths[0]
let listLen = self.listLengths[0]
self.prefixLengths.delete(0)
self.listLengths.delete(0)
let prefixLen = self.prefixLengths[self.listCount]
let listLen = self.listLengths[self.listCount]
self.listCount += 1


if listLen < THRESHOLD_LIST_LEN:
self.update(LIST_START_MARKER + byte(listLen))
Expand All @@ -85,4 +86,3 @@ func clear*(w: var RlpHashWriter) =
w.listLengths.setLen(0)
w.prefixLengths.setLen(0)


0 comments on commit bc0089e

Please sign in to comment.