code: func (h *Hasher) writeNode(n *node, bh hash.Hash, isLeft bool, s []byte) {
  	level := 1
  	for {
  		// at the root of the bmt just write the result to the result channel
  		if n == nil {
  			h.getTree().result <- s
  			return
  		}
  		// otherwise assign child hash to left or right segment
  		if isLeft {
  			n.left = s
  		} else {
  			n.right = s
  		}
  		// the child-thread first arriving will terminate
  		if n.toggle() {
  			return
  		}
  		// the thread coming second now can be sure both left and right children are written
  		// so it calculates the hash of left|right and pushes it to the parent
  		s = doSum(bh, nil, n.left, n.right)
  		isLeft = n.isLeft
  		n = n.parent
  		level++
  	}
  }
docs: // writeNode pushes the data to the node
  // if it is the first of 2 sisters written, the routine terminates
  // if it is the second, it calculates the hash and writes it
  // to the parent node recursively
  // since hashing the parent is synchronous the same hasher can be used