Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: replaces redundant codes in the HashNode with a proper function call #190

Merged
merged 3 commits into from
May 5, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 2 additions & 8 deletions hasher.go
Original file line number Diff line number Diff line change
Expand Up @@ -263,17 +263,11 @@ 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) {
if err := n.ValidateNodeFormat(left); err != nil {
return nil, err
}
if err := n.ValidateNodeFormat(right); err != nil {
// validate the inputs
if err := n.ValidateNodes(left, right); err != nil {
return nil, err
}

// check the namespace range of the left and right children
if err := n.validateSiblingsNamespaceOrder(left, right); err != nil {
return nil, err
}
h := n.baseHasher
h.Reset()

Expand Down