fix some invalid doAssert

This commit is contained in:
andri lim 2020-05-07 11:28:11 +07:00
parent 238b440040
commit 12b6d805cf
No known key found for this signature in database
GPG Key ID: 31702AE10541E6B9
2 changed files with 2 additions and 3 deletions

View File

@ -244,7 +244,7 @@ proc branchNode(t: var TreeBuilder, depth: int, storageMode: bool): NodeKey =
debugEcho "result: ", result.data.toHex, " vs. ", hash.data.toHex
func hexPrefix(r: var RlpWriter, x: openArray[byte], nibblesLen: int, isLeaf: static[bool] = false) =
doAssert(nibblesLen <= 64)
doAssert(nibblesLen >= 1 and nibblesLen <= 64)
var bytes: array[33, byte]
if (nibblesLen mod 2) == 0: # even
when isLeaf:

View File

@ -69,8 +69,7 @@ proc writeNibbles(wb: var WitnessBuilder; n: NibblesSeq, withLen: bool = true) =
let nibblesLen = n.len
let numBytes = nibblesLen div 2 + nibblesLen mod 2
var bytes: array[32, byte]
doAssert(nibblesLen >= 1)
doAssert(numBytes >= 0 and numBytes <= 64)
doAssert(nibblesLen >= 1 and nibblesLen <= 64)
for pos in 0..<n.len:
if (pos and 1) != 0:
bytes[pos div 2] = bytes[pos div 2] or n[pos]