Skip to content

Commit

Permalink
safe pop of leaf hashes
Browse files Browse the repository at this point in the history
  • Loading branch information
walldiss committed May 24, 2024
1 parent 7831a96 commit ec1ad30
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions proof.go
Original file line number Diff line number Diff line change
Expand Up @@ -344,10 +344,8 @@ func (proof Proof) VerifyLeafHashes(nth *NmtHasher, verifyCompleteness bool, nID
// if the leaf index falls within the proof range, pop and return a
// leaf
if proof.Start() <= start && start < proof.End() {
leafHash := leafHashes[0]
// advance leafHashes
leafHashes = leafHashes[1:]
return leafHash, nil
return popIfNonEmpty(&leafHashes), nil
}

// if the leaf index is outside the proof range, pop and return a
Expand Down

0 comments on commit ec1ad30

Please sign in to comment.