Skip to content

Commit 754fba6

Browse files
committed
Update prefix check
1 parent 492bd3c commit 754fba6

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

go/ops.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,8 @@ func (op *InnerOp) CheckAgainstSpec(spec *ProofSpec) error {
8181
if len(op.Prefix) < int(spec.InnerSpec.MinPrefixLength) {
8282
return errors.Errorf("InnerOp prefix too short (%d)", len(op.Prefix))
8383
}
84-
if len(op.Prefix) > int(spec.InnerSpec.MaxPrefixLength) {
84+
maxLeftChildBytes := (len(spec.InnerSpec.ChildOrder) - 1) * int(spec.InnerSpec.ChildSize)
85+
if len(op.Prefix) > int(spec.InnerSpec.MaxPrefixLength)+maxLeftChildBytes {
8586
return errors.Errorf("InnerOp prefix too long (%d)", len(op.Prefix))
8687
}
8788
return nil

0 commit comments

Comments
 (0)