Skip to content

Commit 599044d

Browse files
committed
save finalized tree with its value method
1 parent b8baa18 commit 599044d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

merkle/db.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ func GetFinalizedTree(db types.BasicDB, startLeafIndex uint64) (merkletypes.Fina
6868

6969
// SaveFinalizedTree saves the finalized tree to the db.
7070
func SaveFinalizedTree(db types.BasicDB, finalizedTree merkletypes.FinalizedTreeInfo) error {
71-
value, err := json.Marshal(finalizedTree)
71+
value, err := finalizedTree.Value()
7272
if err != nil {
7373
return err
7474
}
@@ -115,8 +115,8 @@ func GetProofs(db types.DB, leafIndex uint64) (proofs [][]byte, treeIndex uint64
115115
height := uint8(0)
116116
localNodeIndex := leafIndex - treeInfo.StartLeafIndex
117117
for height < treeInfo.TreeHeight {
118-
// In `FinalizeWorkingTree`, we ensure that the leaf count of the tree is always a power of two by filling the leaves as needed.
119-
// This ensures that there is always a sibling for each leaf node.
118+
// In `FinalizeWorkingTree`, we ensure that the leaf count of the tree is always a power of two by filling the leaves as needed.
119+
// This ensures that there is always a sibling for each leaf node.
120120
siblingIndex := localNodeIndex ^ 1 // flip the last bit to find the sibling
121121
sibling, err := GetNodeBytes(db, treeInfo.TreeIndex, height, siblingIndex)
122122
if err != nil {

0 commit comments

Comments
 (0)