Skip to content

Commit

Permalink
Tweak for goose
Browse files Browse the repository at this point in the history
  • Loading branch information
upamanyus committed Dec 9, 2024
1 parent 1daa6e7 commit 679e684
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion merkle/merkle.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,8 @@ func getPath(root *node, label []byte) *node {
func (ctx *context) getProof(root *node, label []byte) []byte {
var proof = make([]byte, 0, cryptoffi.HashLen*hashesPerProofDepth)
var currNode = root
for depth := uint64(0); depth < cryptoffi.HashLen && currNode != nil; depth++ {
var depth = uint64(0)
for depth < cryptoffi.HashLen && currNode != nil {
children := currNode.children
// convert to uint64 bc otherwise pos+1 might overflow.
pos := uint64(label[depth])
Expand All @@ -215,6 +216,7 @@ func (ctx *context) getProof(root *node, label []byte) []byte {
for _, n := range children[pos+1:] {
proof = marshal.WriteBytes(proof, ctx.getHash(n))
}
depth++
}
return proof
}
Expand Down

0 comments on commit 679e684

Please sign in to comment.