Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Clarify partial range validation
  • Loading branch information
Copilot and achamayou authored May 19, 2026
commit 7744b93d22394f736d72b813201c35134e419870
7 changes: 4 additions & 3 deletions merklecpp.h
Original file line number Diff line number Diff line change
Expand Up @@ -1691,9 +1691,10 @@ namespace merkle
protected:
void validate_partial_range(size_t from, size_t to) const
{
if (
empty() || (from < min_index() || max_index() < from) ||
(to < min_index() || max_index() < to) || from > to)
const bool from_out_of_range = from < min_index() || max_index() < from;
const bool to_out_of_range = to < min_index() || max_index() < to;
const bool reversed_range = from > to;
if (empty() || from_out_of_range || to_out_of_range || reversed_range)
{
throw std::runtime_error("invalid leaf indices");
}
Expand Down