witness_from_tree minor refactor
This commit is contained in:
parent
c33fb4deed
commit
ef038c6125
|
@ -106,20 +106,14 @@ proc getBranchRecurseAux(wb: var WitnessBuilder; db: DB, node: openArray[byte],
|
||||||
of 17:
|
of 17:
|
||||||
let branchMask = rlpListToBitmask(nodeRlp)
|
let branchMask = rlpListToBitmask(nodeRlp)
|
||||||
writeBranchNode(wb, branchMask)
|
writeBranchNode(wb, branchMask)
|
||||||
|
let notLeaf = path.len != 0
|
||||||
if path.len != 0:
|
for i in 0..<16:
|
||||||
for i in 0..<16:
|
if branchMask.branchMaskBitIsSet(i):
|
||||||
if branchMask.branchMaskBitIsSet(i):
|
var branch = nodeRlp.listElem(i)
|
||||||
var branch = nodeRlp.listElem(i)
|
if notLeaf and i == path[0].int:
|
||||||
if i == path[0].int:
|
let nextLookup = branch.getNode
|
||||||
let nextLookup = branch.getNode
|
getBranchRecurseAux(wb, db, nextLookup, path.slice(1))
|
||||||
getBranchRecurseAux(wb, db, nextLookup, path.slice(1))
|
else:
|
||||||
else:
|
|
||||||
writeHashNode(wb, branch.expectHash)
|
|
||||||
else:
|
|
||||||
for i in 0..<16:
|
|
||||||
if branchMask.branchMaskBitIsSet(i):
|
|
||||||
var branch = nodeRlp.listElem(i)
|
|
||||||
writeHashNode(wb, branch.expectHash)
|
writeHashNode(wb, branch.expectHash)
|
||||||
|
|
||||||
# put 17th elem
|
# put 17th elem
|
||||||
|
|
Loading…
Reference in New Issue