From fcd3cd0b120447b85a002935dda0e2acc3530f93 Mon Sep 17 00:00:00 2001 From: sanaz Date: Wed, 26 Apr 2023 09:42:57 -0700 Subject: [PATCH] returns the error returned by validateRange --- nmt.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nmt.go b/nmt.go index 26c81d0..0598a5c 100644 --- a/nmt.go +++ b/nmt.go @@ -246,6 +246,7 @@ func (n *NamespacedMerkleTree) ProveNamespace(nID namespace.ID) (Proof, error) { } // validateRange validates the range [start, end) against the size of the tree. +// start is inclusive and end is non-inclusive. func (n *NamespacedMerkleTree) validateRange(start, end int) error { if start < 0 || start >= end || end > len(n.leaves) { return ErrInvalidRange @@ -263,7 +264,7 @@ func (n *NamespacedMerkleTree) buildRangeProof(proofStart, proofEnd int) ([][]by // validate the range if err := n.validateRange(proofStart, proofEnd); err != nil { - return nil, ErrInvalidRange + return nil, err } // start, end are indices of leaves in the tree hence they should be within