Skip to content

Commit

Permalink
chore: delay initialization (#152)
Browse files Browse the repository at this point in the history
Closes #131
  • Loading branch information
rootulp authored Mar 24, 2023
1 parent b34f794 commit eb012d0
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions hasher.go
Original file line number Diff line number Diff line change
Expand Up @@ -244,9 +244,6 @@ func (n *Hasher) ValidateNodes(left, right []byte) error {
// equal to the maximum possible namespace ID value. If all the namespace IDs are equal
// to the maximum possible value, then the maximum possible value is used.
func (n *Hasher) HashNode(left, right []byte) ([]byte, error) {
h := n.baseHasher
h.Reset()

if err := n.ValidateNodeFormat(left); err != nil {
return nil, err
}
Expand All @@ -258,6 +255,8 @@ func (n *Hasher) HashNode(left, right []byte) ([]byte, error) {
if err := n.validateSiblingsNamespaceOrder(left, right); err != nil {
return nil, err
}
h := n.baseHasher
h.Reset()

// the actual hash result of the children got extended (or flagged) by their
// children's minNs || maxNs; hence the flagLen = 2 * NamespaceLen:
Expand Down

0 comments on commit eb012d0

Please sign in to comment.