code: func (h *Hasher) writeSection(i int, section []byte, double bool, final bool) {
  	// select the leaf node for the section
  	var n *node
  	var isLeft bool
  	var hasher hash.Hash
  	var level int
  	t := h.getTree()
  	if double {
  		level++
  		n = t.leaves[i]
  		hasher = n.hasher
  		isLeft = n.isLeft
  		n = n.parent
  		// hash the section
  		section = doSum(hasher, nil, section)
  	} else {
  		n = t.leaves[i/2]
  		hasher = n.hasher
  		isLeft = i%2 == 0
  	}
  	// write hash into parent node
  	if final {
  		// for the last segment use writeFinalNode
  		h.writeFinalNode(level, n, hasher, isLeft, section)
  	} else {
  		h.writeNode(n, hasher, isLeft, section)
  	}
  }
docs: // writeSection writes the hash of i-th section into level 1 node of the BMT tree