Skip to content

Commit

Permalink
Update merkle/db.go
Browse files Browse the repository at this point in the history
Co-authored-by: beer-1 <[email protected]>
  • Loading branch information
sh-cha and beer-1 authored Dec 10, 2024
1 parent d6746f9 commit 73c7f5f
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions merkle/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ func GetProofs(db types.DB, leafIndex uint64) (proofs [][]byte, treeIndex uint64
height := uint8(0)
localNodeIndex := leafIndex - treeInfo.StartLeafIndex
for height < treeInfo.TreeHeight {
// In `FinalizeWorkingTree`, we ensure that the leaf count of the tree is always a power of two by filling the leaves as needed.
// This ensures that there is always a sibling for each leaf node.
siblingIndex := localNodeIndex ^ 1 // flip the last bit to find the sibling
sibling, err := GetNodeBytes(db, treeInfo.TreeIndex, height, siblingIndex)
if err != nil {
Expand Down

0 comments on commit 73c7f5f

Please sign in to comment.