From ebfe91e0886172d8718b53d50dbd5eaf576a20d8 Mon Sep 17 00:00:00 2001 From: sanaz <sanaztaheri@ieee.org> Date: Thu, 4 May 2023 10:53:18 -0700 Subject: [PATCH] removes the duplicate codes --- hasher.go | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/hasher.go b/hasher.go index 3806ba1a..cc3a1293 100644 --- a/hasher.go +++ b/hasher.go @@ -256,17 +256,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()