Skip to content

Commit

Permalink
tree: after serializing transform first layer to hashed nodes
Browse files Browse the repository at this point in the history
Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com>
  • Loading branch information
jsign committed Jul 4, 2023
1 parent 628f400 commit 188a188
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tree.go
Original file line number Diff line number Diff line change
Expand Up @@ -1538,6 +1538,14 @@ func (n *InternalNode) BatchSerialize() ([]SerializedNode, error) {
}
}

for i := range n.children {
if ch, ok := n.children[i].(*InternalNode); ok {
n.children[i] = ch.toHashedNode()
} else if ch, ok := n.children[i].(*LeafNode); ok {
n.children[i] = ch.ToHashedNode()
}
}

return ret, nil
}

Expand Down

0 comments on commit 188a188

Please sign in to comment.