Skip to content

Commit

Permalink
Properly handle left/rightBranchesAreEmpty with custom ordering
Browse files Browse the repository at this point in the history
  • Loading branch information
ethanfrey committed Feb 27, 2022
1 parent fb04c7f commit 143288f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions go/proof.go
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,8 @@ func leftBranchesAreEmpty(spec *InnerSpec, op *InnerOp) bool {
return false
}
for i := 0; i < leftBranches; i++ {
from := actualPrefix + i*int(spec.ChildSize)
idx := getPosition(spec.ChildOrder, int32(i))
from := actualPrefix + idx*int(spec.ChildSize)
if !bytes.Equal(spec.EmptyChild, op.Prefix[from:from+int(spec.ChildSize)]) {
return false
}
Expand All @@ -373,7 +374,8 @@ func rightBranchesAreEmpty(spec *InnerSpec, op *InnerOp) bool {
return false // sanity check
}
for i := 0; i < rightBranches; i++ {
from := i * int(spec.ChildSize)
idx := getPosition(spec.ChildOrder, int32(i))
from := idx * int(spec.ChildSize)
if !bytes.Equal(spec.EmptyChild, op.Suffix[from:from+int(spec.ChildSize)]) {
return false
}
Expand Down

0 comments on commit 143288f

Please sign in to comment.